preload
Mar 10

Sometime you may want to change the user login name into different one,
In that case you can use two options

(Login or switch to root mode – su)

Method 1: ( Using usermod command )
usermod -l newname oldname

Example
#usermod -l anthoniraj antony

Here the user antony has been changed to anthoniraj

Method 2 : ( Using chfn command )
chfn -f newname oldname

Example
#chfn -f thiraviam thiravi

Here the user thiravi has been changed to thiraviam

Note : The old user name should exists in /etc/passwd file .
These above two commands will only change the user name, not user home directory.

Oct 18

1) The “groupadd” command creates a new group account
[root@MB327SCS068 ~]# groupadd netadmin
groupadd: group netadmin exists
[root@MB327SCS068 ~]# groupadd network

2) Adding users into network group
[root@MB327SCS068 ~]# useradd antony -g network
useradd: user antony exists
[root@MB327SCS068 ~]# useradd antonyraj -g network
[root@MB327SCS068 ~]# useradd ligory -g network
[root@MB327SCS068 ~]# useradd basha -g network

3) Setting and changing group password (gpasswd)
[root@MB327SCS068 ~]# gpasswd network
Changing the password for group network
New Password:
Re-enter new password:

4) Using “groupmod” command , we can change the group id (option -g) and name (-n)
[root@MB327SCS068 ~]# groupmod -n admin network

4) Deleting Group “groupdel” – You may not remove the primary group of any existing user. You must remove the user before you remove the group.
[root@MB327SCS068 ~]# groupdel admin
groupdel: cannot remove user’s primary group.
[root@MB327SCS068 ~]# userdel antonyraj
[root@MB327SCS068 ~]# userdel
usage: userdel [-r] name
[root@MB327SCS068 ~]# userdel ligory
[root@MB327SCS068 ~]# userdel basha
[root@MB327SCS068 ~]# groupdel admin

Sep 20

The following commands are used to manage the users on your Linux OS
1. useradd – Create a new user or update default new user information
Example :
[root@myserver ~]# useradd admin

2. passwd – Used to change the user passwd
Example :
[root@myserver ~]# passwd admin
Changing password for user admin.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
(For full details – Refer User Creation Article)

3. userpasswd – A graphical tool to allow users to change their passwords.
Example :
[root@myserver ~]# userpasswd (display one GUI window for changing password)

4. userdel – Delete a user account and related files
Example :
[root@myserver ~]# userdel -r admin
[root@myserver ~]#
The -r option
All user details will be removed from /etc/passwd , /etc/group and /etc/shadow .

5. userinfo – A graphical equivilient to chfn.
Example :
[root@myserver ~]# userinfo

6. usermod – Modify a user account
Example :
i) Changing User home directory
usermod -d /usr/antony
ii) Changing user shell
usermod -s /bin/csh
iii) Setting user expiry date (Date format : YYYY/MM/DD)
usermod -e 2007/09/30

7. usernetctl – allow a user to manipulate a network interface if permitted
Example :
[root@myserver ~]# usernetctl
usage: usernetctl
[root@myserver ~]# usernetctl eth0 report
[root@myserver ~]# usernetctl eth0 up
[root@myserver ~]#

8. users – print the user names of users currently logged in to the current host
Example :
[root@myserver ~]# users
root raj exam1
[root@myserver ~]#