Skip to main content

What is a User?

Every process (running program) 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 user associated with a running process determines the files and directories accessible to that process.
The id command is used to show information about the current logged-in user. Basic information about another user can also be requested by passing in the username of that user as the first argument to the id command.
[student@desktopX ~]$ id
uid=1000(student) gid=1000(student) groups=1000(student),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
To view the user associated with a file or directory, use the ls -l command. The third column shows the username:
[student@serverX ~]$ ls -l /tmp
drwx------. 2 gdm     gdm      4096 Jan 24 13:05 orbit-gdm
drwx------. 2 student student  4096 Jan 25 20:40 orbit-student
-rw-r--r--. 1 root    root    23574 Jan 24 13:05 postconf
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 first column shows the username:
[student@serverX ~]$ ps au
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       428  0.0  0.7 152768 14400 tty1     Ss+  Feb03   0:04 /usr/bin/Xorg 
root       511  0.0  0.0 110012   812 ttyS0    Ss+  Feb03   0:00 /sbin/agetty 
root      1805  0.0  0.1 116040  2580 pts/0    Ss   Feb03   0:00 -bash
root      2109  0.0  0.1 178468  2200 pts/0    S    Feb03   0:00 su - student
student   2110  0.0  0.1 116168  2864 pts/0    S    Feb03   0:00 -bash
student   3690  0.0  0.0 123368  1300 pts/0    R+   11:42   0:00 ps au
The output of the previous commands displays users by name, but internally the operating system tracks users by a UID number. The mapping of names to numbers is defined in databases of account information. By default, systems use a simple "flat file," the /etc/passwd file, to store information about local users.
The format of /etc/passwd (seven colon-separated fields):
1username:2password:3UID:4GID:5GECOS:6/home/dir:7shell 
Item Description
1 username is a mapping of a UID to a name for the benefit of human users.
2 password is where, historically, passwords were kept in an encrypted format. Today, they are stored in a separate file called /etc/shadow.
3 UID is a user ID, a number that identifies the user at the most fundamental level.
4 GID is the user's primary group ID number. Groups will be discussed in a moment.
5 GECOS field is arbitrary text, which usually includes the user's real name.
6 /home/dir is the location of the user's personal data and configuration files.
7 shell is a program that runs as the user logs in. For a regular user, this is normally the program that provides the user's command line prompt.

What is a Group?

Like users, groups have a name and a number (GID). Local groups are defined in /etc/group.
Primary Groups
  • Every user has exactly one primary group.
  • For local users, the primary group is defined by the GID number of the group listed in the fourth field of /etc/passwd.
  • Normally, the primary group owns new files created by the user.
  • Normally, 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 Private Group (UPG).
Supplementary Groups
  • Users may be a member of zero or more supplementary groups.
  • The users that are supplementary members of local groups are listed in the last field of the group's entry in /etc/group. For local groups, user membership is determined by a comma-separated list of users found in the last field of the group's entry in /etc/group:
    groupname:password:GID:list,of,users,in,this,group
  • Supplementary group membership is used to help ensure that users have access permissions to files and other resources on the system.

Comments

Popular posts from this blog

Special Permissions in linux

The setuid permission on an executable file means that the command will run as the user owning the file, not as the user that ran the command. One example is the passwd command: [student@desktopX ~]$ ls -l /usr/bin/passwd -rw s r-xr-x. 1 root root 35504 Jul 16 2010 /usr/bin/passwd In a long listing, you can spot the setuid permissions by a lowercase s where you would normally expect the x (owner execute permissions) to be. If the owner does not have execute permissions, this will be replaced by an uppercase S . The special permission setgid on a directory means that files created in the directory will inherit their group ownership from the directory, rather than inheriting it from the creating user. This is commonly used on group collaborative directories to automatically change a file from the default private group to the shared group, or if files in a directory should be

The Seven-Step Model of Migration

Irrespective of the migration approach adopted, the Seven-step Model of Cloud Migration creates a more rational point of view towards the migration process and offers the ability to imbibe several best practices throughout the journey Step 1: Assess Cloud migration assessments are conducted to understand the complexities in the migration process at the code, design and architectural levels. The investment and the recurring costs are also evaluated along with gauging the tools, test cases, functionalities and other features related to the configuration. Step 2: Isolate The applications to be migrated to the cloud from the internal data center are freed of dependencies pertaining to the environment and the existing system. This step cuts a clearer picture about the complexity of the migration process. Step 3: Map Most organisations hold a detailed mapping of their environment with all the systems and applications. This information can be used to distinguish between the

RequestsDependencyWarning: urllib3 (1.24.1) or chardet (3.0.4) doesn't match a supported version

import tweepy /usr/lib/python2.7/dist-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.24.1) or chardet (3.0.4) doesn't match a supported version!   RequestsDependencyWarning) Traceback (most recent call last):   File "<stdin>", line 1, in <module>   File "/usr/local/lib/python2.7/dist-packages/tweepy/__init__.py", line 14, in <module>     from tweepy.api import API   File "/usr/local/lib/python2.7/dist-packages/tweepy/api.py", line 12, in <module>     from tweepy.binder import bind_api   File "/usr/local/lib/python2.7/dist-packages/tweepy/binder.py", line 11, in <module>     import requests   File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 97, in <module>     from . import utils   File "/usr/lib/python2.7/dist-packages/requests/utils.py", line 26, in <module>     from ._internal_utils import to_native_string   File "/usr/lib/python2.

tag