Created
December 6, 2018 18:49
-
-
Save md-shadhin/773cda1c3104d76f35b9917b815be64a to your computer and use it in GitHub Desktop.
Add a new user on Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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