2020年3月30日 星期一

Ubuntu 18.04 LTS add or remove user


#  sudo adduser username

Adding user `username' ...
Adding new group `username' (1001) ...
Adding new user `username' (1001) with group `username' ...
Creating home directory `/home/username' ...
Copying files from `/etc/skel' ...
You will be asked a series of questions. The password is required and all other fields are optional.

Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for username
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
Finally, confirm that the information is correct by entering Y.

By default on Ubuntu, members of the group sudo are granted with sudo access.
If you want the newly created user to have administrative rights, add the user to the sudo group:

#  sudo usermod -aG sudo username


To delete the user, without deleting the user files, run:
sudo deluser username

If you want to delete and the user’s home directory and mail spool use the --remove-home flag: \
sudo deluser --remove-home username

沒有留言:

張貼留言