A
command to list all users? And how to add, delete, modify users?
To list all users you can use:
To remove/delete a user, first you can use: (2 commands for username and directory)
(Please use with caution the above command!)
To modify the username of a user:
To list all users you can use:
$ cut -d: -f1 /etc/passwd
To
add a new user you can use:$ sudo adduser
new_username
or:$ sudo useradd
new_username
See
also: What is the
difference between adduser and useradd?To remove/delete a user, first you can use: (2 commands for username and directory)
Then you may want to delete the home directory for the deleted user account :$
sudo userdel
username
$ sudo rm -r /home/username
(Please use with caution the above command!)
To modify the username of a user:
To change the password for a user:$ usermod -l
new_usernameold_username
$ sudo passwd
username
To
change the shell for a user:$ sudo chsh
username
To
change the details for a user (for example real name):$ sudo chfn
username
And,
of course, see also: man
adduser
,
man
useradd
,
man
userdel
...
and so on.
No comments:
Post a Comment