1 / 10

Linux Users and Groups

Linux Users and Groups. The passwd file. All Linux users of a system are represented in a file found in /etc/ passwd . As far as the kernel is concerned, it uses only uid number , it is not aware there is a user name in plain text. These uid numbers can be found in the passwd file.

Télécharger la présentation

Linux Users and Groups

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linux Users and Groups

  2. The passwd file All Linux users of a system are represented in a file found in /etc/passwd. As far as the kernel is concerned, it uses only uid number, it is not aware there is a user name in plain text. These uid numbers can be found in the passwdfile. Some lines from the passwd file:- apache:x:48:48:Apache:/var/www:/bin/bash postfix:x:89:89::/var/spool/postfix:/sbin/nologin webalizer:x:67:67:Webalizer:/var/www/html/usage:/sbin/nologin There are 7 fields on each line of the passwd file. Each field is separated by a colon ‘:’. Each line represents one user account.

  3. Understanding the passwd file format

  4. Every Linux process must be associated with a uid number. Every file must be owned with a uid. The /etc/passwd file maps uids and gids to user accounts. It also contains information regarding user home directory and login shell. To change user’s password, we use the ‘passwd’ command. There are 3 general types of user accounts

  5. Group file There is another file /etc/group. This file defines valid groups in the system. It also defines group membership. With group membership, different users can belong to the same group. Users have a primary group defined in /etc/passwd. Users may also be members of mulitple secondary groups defined in /etc/group.

  6. Group file format Every line in the /etc/group file defines one group. It has 4 fields separated by a colon ‘:’.

  7. Group file example wrestle:x:201:ventura,hogan,elvis physics:x:202:einstein,maxwell,elvis emperors:x:203:nero,julius,elvis governor:x:204:ventura,pataki music:x:205:elvis,blondie,prince,madonna dwarfs:x:206:sleepy,grumpy,doc elvis:x:501: prince:x:502: madonna:x:504: blondie:x:505:

  8. How to create users and groups Only the root user can create users and groups. Uses the ‘useradd’ command, to add new users. The ‘userdel’ command to delete users. Uses the ‘groupadd’ command to add new groups. The ‘groupdel’ command to delete groups.

  9. User information The ‘id’ command produces an output describing the uidand gid(s) of the current user. Use the ‘whoami’ command to find out the name of the current user. The ‘who’, ‘users’ and ‘w’ commands identifies users currently logged-in on the system. The ‘finger’ command produces an output indicating when users were last logged-in.

  10. Changing user identity To change to a different user identity, we use the ‘su’ command. You must have the password of the identity, if you are not the root user. It is normal to use the ‘-’ option for the ‘su’. This causes the user’s login shell to be executed. The ‘newgrp’ command allows a user to switch his current group to another group identity.

More Related