2015年8月29日 星期六

Red Hat 7 chapter 5

What is a user?

  • Every process on the system runs as a particular user. Every file is owned by a particular user. Access to files and directories are restricted by user. 
  • The id command is used to show information about the current logged-in user.
  • Basic information about another user also be requested by passing in the username of that user as the first argument to the id command.
  • To view process information use the ps command.The default is to show only processes in the current shell.Add the a option to view all processes with a terminal. To view the user associated with a process , include the u option.
  • The format of /etc/passwd follows :                 username:password:UID:GID:GECOS:/home/dir:shell  
            password is where,historically,passwords were kept in an encrypted format.They are stored                 in a separate file called /etc/shadow.
            UID is a user ID, GID is the user's primary group ID number,
            GECOS field is arbitrary text,which usually includes the user's real name.
            shell is a program that runs as the user logs in.

What is a group?

  • Like users, groups have a name and number(GID). Local groups are defined in /etc/group.
  • Every user has exactly one primary group.
  • The primary group of a newly created user is a newly created group with the same name as the user. The user is the only member of this User Primary Group(UPG).
Managing Local User And Group Accounts

                   User              group
create      #useradd         #groupadd
modify     #usermod       #groupmod
remove    #userdel         #groupdel


   groupadd command -g GID option is used to specify a specify GID.
   The -r option will create a system group using a GID from the range of valid system GID number           listed in the /etc/login.defs files.
   The groupmod command is used to change a group name to a GID mapping.
   The -n option is used to specify a new name.
   The -g option is used to specify a new GID.

Usermod alters group membership

  • The membership of a group is controlled with user management.
  • Change a user's primary group with #usermod -g groupname.
  • Add a user to a supplementary group with #usermod -aG groupname username.


沒有留言:

張貼留言