Skip to content

Instantly share code, notes, and snippets.

@md-shadhin
Created December 6, 2018 18:49
Show Gist options
  • Select an option

  • Save md-shadhin/773cda1c3104d76f35b9917b815be64a to your computer and use it in GitHub Desktop.

Select an option

Save md-shadhin/773cda1c3104d76f35b9917b815be64a to your computer and use it in GitHub Desktop.
Add a new user on Linux
#1 Add user without password non-interactively
adduser --disabled-password --gecos "" username_new_user
#2 Grant root access to the user
usermod -aG sudo username_new_user
#3 Create a folder named .ssh
cd /home/username_new_user
mkdir ~/.ssh
#4 Create a blank file named id_rsa
cd ~/.ssh
touch id_rsa
#5 Change the file permission of id_rsa
sudo chmod 0444 id_rsa
#6 Change the ownership
sudo chown -R username_new_user: /home
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment