Chsh : This command is used to change the default shell for a user account or you even can remove the shell from an account in case it is not required.
1 : Print the available shells in the system.
# chsh -l
2 : Change your default login shell . Run below command. chsh will accept the full pathname of any executable file on the system. However, it will issue a warning if the shell is not listed in the /etc/shells file
# chsh -s 'shell_absolute_path' 'username'
3 : Set a user account as no login from shell.
# chsh -s /bin/false 'username'
Su : This command is used to switch between user accounts or run a command with substitute user account or id.
1 : Switch to root account. simply run 'su' or 'su -' and give password for root.
# su -
2 : Switch login to another user account, run below command.
# su -l 'username'
3 : Switch to a non-login system/user account, run below command.This command required root access.
# su -s /bin/bash 'system_account_name'
4 : Pass command to the shell other then default one with any user, run below command. User must have sudo access.
# sudo su -s /shell/absoulte/path usrname 'commands'
Example :
# sudo su -s /bin/sh akay -c 'ls | sort > /home/test/test.txt'
Groupadd : The 'groupadd' command creates a new group account using the values specified on the command line plus the default values from the system
1 : Create a new group , run below command from terminal.
# groupadd 'group_name'
2 : Create a new group with specified GID , run below command from terminal.
# groupadd -g 'GID_value' 'group_name'
Example :
# groupadd -g 1600 database
3 : If you are creating a group with an existing GID number then run below command to choos sytem automatically a GID with success and dont through error.
# groupadd -f -g 'GID_value' 'group_name'
Groupdel : The 'groupdel' command will delete a group from system.
# groupdel 'group_name'
Groupmod : The 'groupmod' command modifies the definition of the specified GROUP by modifying the appropriate entry in the group database.
1 : Run below command if you want to change groupname.
# groupmod -n 'newname' 'oldname'
2 : Run below command if you want to change the GID of an existing group.
# groupmod -g 'GID_value' 'group_name'
Groups : The 'groups' command can be use to check the assigned groups to a user.
# groups
Gpasswd : This command utility is use to administer the /etc/gshadow and /etc/groups files. With this command you can manage the groups for users , create an administrator for a particular group and allow him/her to manage that group. He will be able to add or remove any user from that group and manage permissions for that group.Every group can have administrators, members and a password
1 : Define an administrator for a group.Only used by root user.
# gpasswd -A 'user_name' 'group_name'
Above command will set a user as admin for specfied group.
2 : Add users as member to a specfied group.You can specify multiple user seperated by commo.Only used by root user.
# gpasswd -M 'user1,user2' 'group_name'
3 : Add users as member to a specfied group by group admin only.
# gpasswd -a 'user1,user2' 'group_name'
4 : Remove user as member from specfied group by group admin only.
# gpasswd -d 'user1' 'group_name'
5 : Set password for a group.
# gpasswd 'group_name'
Above command will prompt you to set a password for that group. After settin up a password still members can access that group without entering a password but non members have to supply the password.
Newgrp : This command is use to access any group as primary group if you are not a primary member of that group.Please supply the password if asked.
1 : login to another group for current session only
# newgrp 'group_name'
2 : login to another group with reinitialized the user's environment.
# newgrp - 'group_name'
Pwck or Grpck : These both command are used to verifiy the integrity of the users/groups and authentication information. It checks that all entries in /etc/passwd , /etc/group , /etc/gshadow and /etc/shadow have the proper format and contain valid data. The user is prompted to delete entries that are improperly formatted or which have other uncorrectable errors
# pwck /etc/passwd
# pwck /etc/shadow
# grpck /etc/gshadow
# grpck /etc/group
0 Comments