Users and groups

Authorization to files and other resources are provided by users and groups. Users have unique usernames that are human-friendly identifiers, but from the operating system side, each user is represent by a unique positive integer: the User ID (UID). Groups are the other authorization mechanism and, as users, they have a name and a Group ID (GID). In the operating system, each process is associated with a user and each file and directory belongs to both a user and a group.

The /etc/passwd file contains all this information and more:

# username : encrypted password : UID : GID : full name : home directory : login shell
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
...

user:x:1000:1000:"User Name":/home/user:/bin/bash

Users don't use UID directly; they use a combination of username and password in order to start their first process, the interactive shell. Children of the first shell inherit their UID from it, so they keep belonging to the same user.

The UID 0 is reserved for a user known as root, which has special privileges and can do almost anything on the system, such as read/write/execute any file, kill any process, and change running process UIDs.

A group is a logical collection of users, used to share files and directories between them. Each group is independent of other groups and there is no specific relationship between them. For a list of the groups that the current user belongs to, there's the groups command. To change group ownership of a file, there's chgrp.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.214.155