Filed under:

Where are the User and Group details stored on my server ?




All Linux distributions should keep their user and group data files in the same place, usually:
  • User account information
    /etc/passwd
  • Secure user account information
    /etc/shadow
  • Group information
    /etc/group
  • Samba Users secure account information
    /etc/smbpasswd

Format of /etc/passwd

The /etc/passwd file gives a listing of the users that have accounts on the system. Users are typically added using the adduser or useradd commands.

username:password:uid:gid:user_info:home_directory:shell_type
username - The name the person logs in with
password - Typically x to indicate a password is set
uid - User ID number set by the system to indicate which files they own or have access to.
gid - Group ID number set by the system to indicate which is the primary group the user belongs to.
user_info - Additional information about the user separated by a commas. Example User_Info Full name, Phone number, etc.
home_directory - The directory that the user owns and shoudl start shell sessions in. Usually /home/username
shell_type - The default shell setting is /bin/bash, for no shell this would be /bin/false etc.

Format of /etc/shadow

The /etc/shadow file holds the users encrypted passwords.

username:encrypted password:11843:0:99999:7:::
username - The username from /etc/passwd that the person logs in with
encrypted password - The encrypted version of the password
#:#:#:#::: - Contains information about the number of days since the password was changed, when it expires or is disabled.

Format of /etc/group

The /etc/group file contains the groups that have been created on the system and lists the members of each group. Groups are typically added using the addgroup or groupadd commands.

Users can be added to an already existing group by adding the additional usernames to the end of the other usernames or after the semicolon of the gid if there are no members beyond the primary user.

groupname:password:gid:username1,username2,username3
groupname - The name the group
password - An x indicates a password is set and if left blank no password has been set.
gid - The group id number which is the principle group they belong to.
usernames - Members of the group separated by a comma

Format of /etc/smbpasswd

The /etc/smbpasswd file contains the encrypted Samba Users password details.

username:encrypted password:11843:0:99999:7:::
username - The username from that the person connect to the Samba service with
encrypted password - The encrypted version of the password
#:#:#:#::: - Contains information about the number of days since the password was changed, when it expires or is disabled.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

Language: