1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
//add user sudo useradd [username] or //Use the -m to create the user home directory as /home/[username] sudo useradd -m [username] //if need to set password sudo passwd [username] #Changing password for user. #New password: #Retype new password: #passwd: all authentication tokens updated successfully. //add to sudo //for centos usermod -aG wheel username //for ubuntu usermod -aG sudo username //add ssh key to signin make file to /home/[username]/.ssh/authorized_keys then add public key into that file. Done. //sometime, you create an user and you can login successfully, but you can't use common command (e.g. tab auto/vi...) When you add a user with useradd there is no special shell added. You can see this with the command:cat /etc/passwd The new user is no special shell added. To fix this you can: chsh -s /bin/bash [the new username] and the "/bin/bash" just reference the root one. |