Post

Create new Linux User

Create new User

1
sudo adduser nguyen.van.a

Add SSH key

1
2
3
4
sudo mkdir /home/nguyen.van.a/.ssh/
sudo chmod 0700 /home/nguyen.van.a/.ssh/
sudo -- sh -c "echo 'ssh-ed25519 AAAAC3NzaC1lZDi1NTE5AAAAILaLvLmaW9qIbUVo1aDHWZE9JehbNfIdTVif2aFGF0E0 me@ngockhuong' > /home/nguyen.van.a/.ssh/authorized_keys"
sudo chown -R nguyen.van.a:nguyen.van.a /home/nguyen.van.a/.ssh/

Add User to Sudoers & Sudo Group

1
2
3
sudo usermod -aG sudo nguyen.van.a
groups nguyen.van.a
su - nguyen.van.a

Remove User from Sudo Group

1
2
# sudo deluser <username> <group>
sudo deluser nguyen.van.a sudo
This post is licensed under CC BY 4.0 by the author.