Topics Summary

 

As a follow up to the user and group management, we will discuss couple important files on Linux/UNIX flavor machines.

 

/etc/group

This file that contains group names and group id’s information available on that system.

 

Sample output of /etc/group file:

The fields in this file are groupname: x: gid

To see all groups the command is #cat /etc/group

To see the particular group information from file is,

#grep <groupname> /etc/group.

 

/etc/passwd

This file contains all the user account related information on machine.

The fields in /etc/passwd are ‘ username:x:uid:gid:comment:home directory:shell

To see all the users the command is

# cat /etc/passwd

 

To see one particular user information,

# grep <username> /etc/passwd

 

 

/etc/shadow

This one contains all password information for the user accounts.

The fields in /etc/shadow file are ‘username:<encrypted password>:password ageing’.

What are the Files related to User and group management?

 

What are the Files irrespective of user and shell for user administration?

/etc/motd
/etc/profile
/etc/bashrc

 

/etc/motd is the file for message of the day. The messages in /etc/motd file execute on user console when user logged in.

#vi /etc/motd
There is no substitute for hardwork.
:wq!

 

For testing open the new session

login as: root
root@192.168.1.29's password:
Last login: Tue Jan 26 13:06:41 2016 from 192.168.1.4
Server is going down save the data!
[root@sys2 ~]#

 

/etc/profile : The messages in /etc/profile execute on user console when user logged in. It is global profile for everyone.

#vi /etc/profile
Press ‘esc+shift+g ‘ to go to lastpage last line
Echo HAVE A NICE DAY
:wq!

 

For testing open new session

login as: root
root@192.168.1.29's password:
Last login: Tue Jan 26 17:55:03 2016 from 192.168.1.4
Server is going down save the data!
start coding urgently!

 

What are The files related with respective of user and shell?

  • .bash_profile Executes when user logged in.
  • .bash_logout Executes when user logged out.
  • .bash_history Maintains the history of all commands executed by the user.
  • .bashrc For bash shell.

These files are also called user profiles or user environmental files or local profiles or local environment files.

 

The user default parameters are stored in /etc/default/useradd 

#vi /etc/default/useradd
HOME = /home
INACTIVE= Number of days user accounts should be disable.
EXPIRE= Expiry date for all users.
SHELL= /bin/bash
SKELL=/etc/skell

 

/etc/skel is the directory that contains user environment files.

The files in /etc/skel directory copied to user home directory when user is created using useradd command.

#useradd –D ----- To list the default user parameters.
The user default login values are stored in /etc/login.defs