You are here
Home > Redhat > User Administration

User Administration

User administration Commands

useradd <username>

passwd <username>

While using the above commands of creating a user it reflects to three files /etc/passwd,/etc/group,/etc/shadow

/etc/passwd

sysadmin:x:500:500:Sys:/home/sysadmin:/bin/bash

/etc/shadow

sysadmin:$1$L6icvM39$i9FdAwunWV9Xkw2nO0F.Y0:14880:0:99999:7:::

/etc/group

sysadmin:x:503:

whereas unpriviledged users uid&gid will start from 500

The uid&gid between 1-499 will be for system users and groups uid&gid for processing a system process

Usage of Usermod command

To Add the Comment Entry

     # usermod -c <Comment><User Name>

To Change the home directory

     # usermod –d <Home Directory><User Name>

To Change the User ID

     # usermod –u <New UID><User Name>

To Change the Group ID

     # usermod –g <Existing GID><User Name>
 
To add users to a Supplementary Group

      # usermod -G pp2 pp3 [ Adding user pp3 to group pp2 ]

      # usermod -G pp2 pp1 [ Adding user pp1 to group pp2 ]

To change the User’s login name

      # usermod -l <New Login Name><User Name>

To change a user's shell

     # usermod -S /sbin/nologin <User Name>

Alternate way of changing a shell is by giving command in prompt as chsh

     # chsh <UserName>

To lock a user's passwd

     # usermod -L sysadmin

To Unlock a users passwd

     # usermod -U sysadmin

     # userdel

     # userdel -r

To delete a User [ This is will not remove the User’s Home Directory. ]

     # userdel <User Name>

To delete a User including Home Directory.

     # userdel -r < User Name>

Group Administration Commands

To add a group

     # groupadd <groupname>

To change a group

    # groupmod <newgroupname><oldgroupname>

To delete a group

    # groupdel <groupname>

Leave a Reply

Top