add a user: sudo adduser [newuser]
sudo adduser john
then give password, and setup home folder,when prompted
edit the list of super users
visudo
list users
cat /etc/passwd
change password of a user – sudo passwd [username]
sudo passwd john
to change your password you can just use sudo passwd.
delete user
sudo deluser username
This will not delete the home folder (and subfolder) those must be dealt with separately. A new user created with the old user name would have access to those files.
temporarily lock a user account – Simply locking a user account will not prevent a user from logging into your server remotely if they have previously set up RSA public key authentication.
sudo passwd -l username
To unlock the account
sudo passwd -u username
Groups
Groups are used in to control permissions (see file permissions)
add user to a group
usermod -G [group-name] [username]
usermod -G basketball john
using the -G switch ads the group as a supplemental group. Using -g would make the group that users primary group.
see what groups a user is in
id john
add a new group: groupadd [new_group_name]
groupadd ruby_developers
Pingback: Locking and Unlocking a User in Ubuntu | Coding and Server Syntax Examples