The id command prints information for a certain user. Use it like this:
# id username To create a new user:
# useradd --home /home/username username # passwd username
If you want to activate the user you have to assign a password, because initially the user account is in disabled state.
These are some useful useradd options to create user:
-c : sets a comment for the user.
-s : is used in order to define the user’s default login shell. If not used, then the system’s default shell becomes the user’s default login shell.
-r : creates a user with UID<500 (system account)
-d : sets the user’s home directory. If not used, the default home directory is created (/home/username/)
-M : the home directory is not created. This is useful when the directory already exists.
The newly created user don’t have the ability to login to a shell, To enable the shell login you have to issue the following command:
# useradd -c "This user cannot login to a shell" -s /sbin/nologin username # passwd username
Change the user’s password
To change a user’s password:
# passwd username
If you want to change the current user’s password type without specifying a username.
Check more Linux related stuff from Linux Category.