user Management in Linux

What is user?

Every process is owned by a particular user. Access to files and directories are restricted by user. The id command is used to show information about the current logged-in user.

View user

To view the user associated with a file or directory, use ls –l command. Third column shows the username.
            # ls –l /tmp

Managing local users

useradd command is used to create new user.
            # useradd redhat
            Here redhat is name of new user.
To see created user gives following command:
            # vim /etc/passwd at the bottom created user is listed.

How to Delete user

To delete created user gives following command:
            # userdel username removes user from /etc/passwd, but leaves home directory by default.
            # userdel –r username  removes the user and user’s home directory.

Set password to user

passwd username command is used to set password to particular user.
            # passwd redhat set password for user redhat.

Most Reading