{"id":142,"date":"2018-07-13T06:08:21","date_gmt":"2018-07-13T06:08:21","guid":{"rendered":"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=142"},"modified":"2019-05-16T07:18:02","modified_gmt":"2019-05-16T07:18:02","slug":"user-environment-local-computer-security-in-gnu-linux","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/chapter\/user-environment-local-computer-security-in-gnu-linux\/","title":{"rendered":"User Environment &amp; Local Computer security in GNU\/Linux"},"content":{"raw":"<div><span style=\"float: right;\"><a href=\"https:\/\/youtu.be\/MeSW7ttYRjM\" target=\"_blank\" rel=\"noopener\"><img src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a>\r\n<\/span><\/div>\r\n&nbsp;\r\n\r\n<strong>Introduction<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">As we are aware that Linux supports multiuser, at the same time more than one user can work concurrently into the system. Linux provides the facility to create multiple users and classify them into groups. Linux organizes the users into groups, groups are collections of accounts where certain permissions can be shared among users. The list of groups and their members are stored in a file \/etc\/group file. By default, every user has its own primary or default group. When a user logs into the system, the user gets all permissions assigned to their primary group and all other groups that a user belongs to. A user can belong to one or more groups.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">All Linux users are assigned a user ID(uid) which is unique. The groups also have unique IDs (gid). These IDs are integer numbers and start from zero (0). Most of the users ID start either from 500 (Fedora family) or from 1000(other distributions). The uid and gid can be seen in the file \/etc\/passwd or \/etc\/group files.<\/p>\r\n&nbsp;\r\n\r\n<strong>who command<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The command \u201cwho\u201d can be used to list online users, those users who are currently logged on to the system. Few options of the \u201cwho\u201d command are listed in following table<\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-143 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/Z1.png\" alt=\"\" width=\"569\" height=\"443\" \/><\/p>\r\n<p style=\"text-align: justify;\">As shown in figure 1, the who command lists users who are online. Each line indicates the terminals from where the user has logged in. So, if a user logs in from multiple terminals, the output of who command will display multiple records. In addition to the username, who command lists the login time and the IP address from which the user has logged in.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Now let us study the format of \/etc\/passwd file in which the details of users created within the system are stored. This file contains details that are separated by \u2018:\u2019 sign. Each line of the file represents a user. The file stores details like username, uid, gid, alias of username, default login directory and default shell. When a user logs onto the system, he logs onto a default directory (say \/home\/user) and he uses a default shell. The \/etc\/passwd file contains list of all users who are created within the system. Each user has a single entry in this file.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center;\"><img class=\"wp-image-144 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/Z2.jpg\" alt=\"\" width=\"664\" height=\"277\" \/><\/p>\r\n\r\n<div>\r\n<p style=\"text-align: center;\"><strong>Figure 2: Snapshot of \/etc\/passwd file<\/strong><\/p>\r\n\r\n<\/div>\r\n<p style=\"text-align: justify;\">Let us understand the line containing \u201cDemo\u201d in figure 2. The user name is Demo whose UID=502 and GID=502. When the user \u201cDemo\u201d logs onto the system, he is placed in \/home\/Demo directory and the user gets bash shell to interact with the system. Let us take another case of user \u201chardik\u201d, where the UID and GID are different. Since the user \u201chardik\u201d belongs to more than one group, we can see that UID and GID need not be equal. If we want to know the group to which user \u201chardik\u201d belongs to, we can view the content of \/etc\/groups file.<\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-145 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/1.png\" alt=\"\" width=\"377\" height=\"317\" \/><\/p>\r\n<p style=\"text-align: justify;\">Figure 3 illustrates the content of \/etc\/group file. The \/etc\/group file lists the groups created within the system. The output of \/etc\/group file signifies that the Demo group has GID 502 and no other user belongs to this group except the Demo user. While, the group \u201cfaculty\u201d has another user \u201chardik\u201d as a member of \u201cfaculty\u201d group supply username as an argument to the id command, it shows the details of the username supplied to the command. The syntax of id command can be:<\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-146 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/2.png\" alt=\"\" width=\"641\" height=\"205\" \/><\/p>\r\n&nbsp;\r\n\r\n<strong>User Management<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">In this section, we will learn how to create users, how to modify\/delete the users existing in the system and how to set password to the user. In Linux, the users can be classified into following categories:<\/p>\r\n\r\n<ul>\r\n \t<li>Normal users<\/li>\r\n \t<li>Root user (super user)<\/li>\r\n \t<li>System user<\/li>\r\n \t<li>Network user<\/li>\r\n<\/ul>\r\n<p style=\"text-align: justify;\">A super user has maximum privileges of the system. Generally, administrator tasks are performed by a super user. It is always advisable not to use the super user account for normal use of the system. A super user has privileges to create groups and create other users. A normal user can deal with tasks like sharing of files over network, printing of files, etc. Depending on the services offered by Linux, a user can further be classified as a system user or network user. In this module, our focus will be to understand how a normal user can perform tasks of a super user with proper authentication. Root privileges are required to perform following task:<\/p>\r\n\r\n<ul>\r\n \t<li>Create\/Manager users<\/li>\r\n \t<li>Install or remove software packages<\/li>\r\n \t<li>Remove or modify system files (config files of \/etc direcroty)<\/li>\r\n \t<li>Start\/Stop\/Restart system services (httpd, vsftp, etc.)<\/li>\r\n<\/ul>\r\n<p style=\"text-align: justify;\">When we logon to the system, we would be working as a normal user. A normal user gets \u2018$\u2019 prompt, while the super user gets \u2018#\u2019 prompt. When a super user logs in, we call it root access. Below is the command to transit from normal user to super user:<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-147 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/3.png\" alt=\"\" width=\"640\" height=\"313\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">We can modify the groups of a user, i.e. add a user to particular group or remove the user from some group using usermod command; we can also lock\/unlock users using the usermod command.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The following are few commands to manage groups. We use groupadd command to create a group, groupmod to modify a group and groupdel to delete a group.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-148 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/4.png\" alt=\"\" width=\"625\" height=\"122\" \/><\/p>\r\n<p style=\"text-align: justify;\">The following are few screenshots where we can see how the user is created and how we can assign a user to particular group.<\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-149 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/1.jpg\" alt=\"\" width=\"698\" height=\"327\" \/><\/p>\r\n<p style=\"text-align: center;\"><strong>Figure 4: User creation<\/strong><\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-150 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1.jpg\" alt=\"\" width=\"595\" height=\"172\" \/><\/p>\r\n<p style=\"text-align: center;\"><strong>Figure 5: Modifying a user<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">As shown in figure 5, a user student1 is added to the students group. It is to be noted that the group name \u201cstudents\u201d already existed before typing the usermod command.<\/p>\r\n&nbsp;\r\n\r\n<strong>Operations with root account<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">As we have discussed earlier, root account can be used to perform administrator level tasks. Linux provides two different ways to access root account, they are as follows:<\/p>\r\n\r\n<ul>\r\n \t<li>Using su command<\/li>\r\n \t<li>Using sudo command<\/li>\r\n<\/ul>\r\n<p style=\"text-align: justify;\">It is advisable to use sudo command rather than su command since there are less risks associated if we use the sudo command. In f act, the sudo command is generally used to perform a single task while the su command can be used only when we wish to perform sequence of tasks that require root level access. The following table lists the difference between su and sudo command.<\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-152 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1.png\" alt=\"\" width=\"540\" height=\"252\" \/><\/p>\r\n<p style=\"text-align: justify;\">Let us take an example to understand the difference between su and sudo commands. Suppose, there is a requirement to create 100 users in a system, the system administrator can assign the task of user creation to some operator. Now, if he provides password of su to the operator, the operator may gain access to entire system and he can modify config files or can also delete user accounts. So, the solution is that the administrator will give privileges only to create users in root privileges. The administrator will configure sudoers file and will add the operator details such that the operator can perform useradd command as a super user and cannot perform any other command that requires su password. So, the operator will type following command to create users:<\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-153 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/111.png\" alt=\"\" width=\"601\" height=\"489\" \/><\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-154 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/222.png\" alt=\"\" width=\"627\" height=\"262\" \/><\/p>\r\nThe above notation signifies that who(username) will be allowed to access from were(network id) the specific command that requires su privileges. It further says, that the user will be identified as whom (which group) and what kind of command can be performed.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Whenever a user tries to access sudo command, the activity is logged into the system. So, whenever a normal user accesses sudo to acquire root privileges temporarily, the action is saved as log file. In case of misuse, we can check who tried what kind of commands by looking at the log file.<\/p>\r\n&nbsp;\r\n\r\nAccess to sudo command and failures are logged into files like\r\n<ul>\r\n \t<li>\/var\/log\/auth.log (Debian systems)<\/li>\r\n \t<li>\/var\/log\/messages<\/li>\r\n \t<li>\/var\/log\/secure<\/li>\r\n<\/ul>\r\nA typical message entry will contain:\r\n<ul>\r\n \t<li>Date, time and host name<\/li>\r\n \t<li>Calling username<\/li>\r\n \t<li>Terminal info<\/li>\r\n \t<li>Working directory<\/li>\r\n \t<li>User account invoked<\/li>\r\n \t<li>Command with arguments<\/li>\r\n<\/ul>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-155 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/222222.jpg\" alt=\"\" width=\"938\" height=\"267\" \/><\/p>\r\n<p style=\"text-align: center;\"><strong>Figure 6:Entry into a log file<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The above entry in figure 6 shows that a user \u201cDemo\u201d issued sudo command to access useradd command. Since the sudoers file is very important, it can be accessed by issuing \u201cvisudo\u201d command under root privileges.<\/p>\r\n&nbsp;\r\n\r\n<strong>Environment Variables<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">An environment variable is a named quantity that holds character string. Environment variable contains information that can be accessed by the shell (such as bash) and can be used by one or more applications. Some of the environment variables can be defined by user and some of them are pre-set (built-in) that is provided by the system. The values of environment variables can be accessed by typing set, env or export commands. The set command may behave in a different manner depending on the state of our system. The content of these variables is as follows:<\/p>\r\n<p style=\"text-align: center;\"><img class=\"size-full wp-image-156 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/3333.png\" alt=\"\" width=\"598\" height=\"321\" \/><\/p>\r\n\r\n<div>\r\n\r\n<strong>Few Environment Variables<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Let us see study environment variables that are useful for system administration. HOME is an environment variable that represents the home directory of the user. When we issue the following command , it displays the home (default) directory of the user.<\/p>\r\n&nbsp;\r\n\r\n$ echo $HOME\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">PATH is another environment variable that stores the path of directories that contain executable programs. It is an ordered list of path that is scanned to locate the program\/commands when executed by the user. Each directory stored in the path is separated by colon sign(:). The following command displays the value stored in PATH variable<\/span><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">$echo $PATH<\/span><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">We can add our home directory in the PATH variable by issuing the following command<\/span><\/p>\r\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">\u00a0 $PATH=$PATH:\/home\/&lt;user&gt;<\/span><\/p>\r\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">$echo $PATH<\/span><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">PS1 Variable is abbreviation of Prompt Statement and is used to customize the prompt string. PS1 is the primary prompt variable and it controls how the command prompt looks like The following special characters can be included in PS1 :<\/span><\/p>\r\n\r\n<\/div>\r\n<ul>\r\n \t<li>\\u - User name<\/li>\r\n \t<li>\\h - Host name<\/li>\r\n \t<li>\\w - Current working directory<\/li>\r\n \t<li>\\! - History number of this command<\/li>\r\n \t<li>\\d - Date<\/li>\r\n<\/ul>\r\n<p style=\"text-align: justify;\">The environment variable SHELL points to the user's default command shell (the program that is handling whatever you type in a command window, usually bash) and contains the full pathname to the shell:<\/p>\r\n&nbsp;\r\n\r\n$ echo $SHELL\r\n\r\n\/bin\/bash\r\n\r\n$\r\n\r\n&nbsp;\r\n\r\n<strong>Startup Files<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">When a user logs onto the system (shell prompt), the startup files execute automatically (generally bash) . The startup files are used to customize the users environment. It can be used to perform the following tasks:<\/p>\r\n\r\n<ul>\r\n \t<li>Define command line shortcuts or aliases<\/li>\r\n \t<li>Setting up of the prompt<\/li>\r\n \t<li>Setting up default text editor<\/li>\r\n \t<li>Setting up the PATH variable to execute custom commands<\/li>\r\n<\/ul>\r\n<strong>Order of the Startup Files<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">When we first login to Linux, the \/etc\/profile is accessed and evaluated, after which the following files are searched (if they exist) in the listed order:<\/p>\r\n\r\n<ol>\r\n \t<li>~\/.bash_profile<\/li>\r\n \t<li>~\/.bash_login<\/li>\r\n \t<li>~\/.profile<\/li>\r\n<\/ol>\r\n<p style=\"text-align: justify;\">If the Linux login shell comes across the first file, it ignores the rest of the file. Which means that if it finds ~\/.bash_profile, it ignores ~\/.bash_login and ~\/.profile. Different distributions may use different startup files.<\/p>\r\n&nbsp;\r\n\r\nLet us summarize the key concepts covered in this module\r\n<ul>\r\n \t<li>Concept of users and groups.<\/li>\r\n \t<li>User management and related commands.<\/li>\r\n \t<li>User environment and environment variables.<\/li>\r\n \t<li>Commands for root access like su and sudo.<\/li>\r\n<\/ul>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><strong>you can view video on User Environment & Local Computer security in GNU\/Linux<\/strong><\/td>\r\n<td><a href=\"https:\/\/youtu.be\/MeSW7ttYRjM\" target=\"_blank\" rel=\"noopener\"><img class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<strong>References<\/strong>\r\n<ol>\r\n \t<li style=\"text-align: justify;\">Tom. Adelstein and Bill. Lubanovic. 2007. <em>Linux system administration<\/em>, O\u2019Reilly.<\/li>\r\n \t<li style=\"text-align: justify;\">Sam R. Alapati. 2016. <em>Modern Linux Administration How to Become a Cutting-edge<\/em> <em>Linux Administrator.<\/em>, Oreilly &amp; Associates Inc.<\/li>\r\n \t<li style=\"text-align: justify;\">Kirk. Bauer. 2003. <em>Automating UNIX and Linux administration<\/em>, Apress.<\/li>\r\n \t<li style=\"text-align: justify;\">Richard Blum. 2008. <em>Linux command line and shell scripting bible<\/em>, Wiley Pub.<\/li>\r\n \t<li style=\"text-align: justify;\">M. Carling, Stephen. Degler, and James. Dennis. 2000. <em>Linux system administration<\/em>, New Riders.<\/li>\r\n \t<li style=\"text-align: justify;\">Chuck. Easttom and Serge N. Palladino. 2012. <em>Essential Linux administration\u202f: a<\/em> <em>comprehensive guide for beginners<\/em>, Course Technology\/Cengage Learning.<\/li>\r\n \t<li style=\"text-align: justify;\">Richard Fox. <em>Linux with operating system concepts<\/em>,<\/li>\r\n \t<li style=\"text-align: justify;\">Aeleen. Frisch. 2002. <em>Essential system administration<\/em>, O\u2019Reilly.<\/li>\r\n \t<li style=\"text-align: justify;\">el. . . <em>Linux system administration\u202f: a user\u2019s guide<\/em>, Addison-Wesley.<\/li>\r\n \t<li style=\"text-align: justify;\">Juliet. Kemp. 2009. <em>Linux system administration recipes\u202f: a problem-solution approach<\/em>, Apress.<\/li>\r\n \t<li style=\"text-align: justify;\">Olaf. Kirch and Terry. Dawson. 2000. <em>Linux network administrator\u2019s guide<\/em>, O\u2019Reilly.<\/li>\r\n \t<li style=\"text-align: justify;\">Olaf. Kirch and Terry. Dawson. 2000. <em>Linux network administrator\u2019s guide<\/em>, O\u2019Reilly.<\/li>\r\n \t<li style=\"text-align: justify;\">Mark (Mark F... Komarinski, Cary. Collett, and Inc. Red Hat. 2000. <em>Red Hat Linux<\/em> <em>administration handbook<\/em>, Prentice Hall PTR.<\/li>\r\n \t<li style=\"text-align: justify;\">Chris Negus. <em>Linux bible<\/em>,<\/li>\r\n \t<li style=\"text-align: justify;\">Roderick W. Smith. 2007. <em>Linux administrator street smarts\u202f: a real world guide to Linux<\/em> <em>certification skills<\/em>, John Wiley.<\/li>\r\n \t<li style=\"text-align: justify;\">Wale Soyinka. <em>Linux administration\u202f: a beginner\u2019s guide<\/em>,<\/li>\r\n \t<li style=\"text-align: justify;\">Vicki. Stanfield and Roderick W. Smith. 2002. <em>Linux system administration<\/em>, Sybex.<\/li>\r\n \t<li style=\"text-align: justify;\">Nicholas. Wells. 2000. <em>Guide to Linux installation and administration<\/em>, Course Technology, Thomson Learning.<\/li>\r\n \t<li style=\"text-align: justify;\">Matt. Welsh, Matthias Kalle. Dalheimer, Terry. Dawson, and Lar. Kaufman. 2003. <em>Running Linux<\/em>, O\u2019Reilly.<\/li>\r\n<\/ol>","rendered":"<div><span style=\"float: right;\"><a href=\"https:\/\/youtu.be\/MeSW7ttYRjM\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a><br \/>\n<\/span><\/div>\n<p>&nbsp;<\/p>\n<p><strong>Introduction<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">As we are aware that Linux supports multiuser, at the same time more than one user can work concurrently into the system. Linux provides the facility to create multiple users and classify them into groups. Linux organizes the users into groups, groups are collections of accounts where certain permissions can be shared among users. The list of groups and their members are stored in a file \/etc\/group file. By default, every user has its own primary or default group. When a user logs into the system, the user gets all permissions assigned to their primary group and all other groups that a user belongs to. A user can belong to one or more groups.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">All Linux users are assigned a user ID(uid) which is unique. The groups also have unique IDs (gid). These IDs are integer numbers and start from zero (0). Most of the users ID start either from 500 (Fedora family) or from 1000(other distributions). The uid and gid can be seen in the file \/etc\/passwd or \/etc\/group files.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>who command<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The command \u201cwho\u201d can be used to list online users, those users who are currently logged on to the system. Few options of the \u201cwho\u201d command are listed in following table<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-143 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/Z1.png\" alt=\"\" width=\"569\" height=\"443\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Z1.png 569w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Z1-300x234.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Z1-65x51.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Z1-225x175.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Z1-350x272.png 350w\" sizes=\"auto, (max-width: 569px) 100vw, 569px\" \/><\/p>\n<p style=\"text-align: justify;\">As shown in figure 1, the who command lists users who are online. Each line indicates the terminals from where the user has logged in. So, if a user logs in from multiple terminals, the output of who command will display multiple records. In addition to the username, who command lists the login time and the IP address from which the user has logged in.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Now let us study the format of \/etc\/passwd file in which the details of users created within the system are stored. This file contains details that are separated by \u2018:\u2019 sign. Each line of the file represents a user. The file stores details like username, uid, gid, alias of username, default login directory and default shell. When a user logs onto the system, he logs onto a default directory (say \/home\/user) and he uses a default shell. The \/etc\/passwd file contains list of all users who are created within the system. Each user has a single entry in this file.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-144 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/Z2.jpg\" alt=\"\" width=\"664\" height=\"277\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Z2.jpg 833w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Z2-300x125.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Z2-768x320.jpg 768w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Z2-65x27.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Z2-225x94.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/Z2-350x146.jpg 350w\" sizes=\"auto, (max-width: 664px) 100vw, 664px\" \/><\/p>\n<div>\n<p style=\"text-align: center;\"><strong>Figure 2: Snapshot of \/etc\/passwd file<\/strong><\/p>\n<\/div>\n<p style=\"text-align: justify;\">Let us understand the line containing \u201cDemo\u201d in figure 2. The user name is Demo whose UID=502 and GID=502. When the user \u201cDemo\u201d logs onto the system, he is placed in \/home\/Demo directory and the user gets bash shell to interact with the system. Let us take another case of user \u201chardik\u201d, where the UID and GID are different. Since the user \u201chardik\u201d belongs to more than one group, we can see that UID and GID need not be equal. If we want to know the group to which user \u201chardik\u201d belongs to, we can view the content of \/etc\/groups file.<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-145 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/1.png\" alt=\"\" width=\"377\" height=\"317\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1.png 377w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-300x252.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-65x55.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-225x189.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-350x294.png 350w\" sizes=\"auto, (max-width: 377px) 100vw, 377px\" \/><\/p>\n<p style=\"text-align: justify;\">Figure 3 illustrates the content of \/etc\/group file. The \/etc\/group file lists the groups created within the system. The output of \/etc\/group file signifies that the Demo group has GID 502 and no other user belongs to this group except the Demo user. While, the group \u201cfaculty\u201d has another user \u201chardik\u201d as a member of \u201cfaculty\u201d group supply username as an argument to the id command, it shows the details of the username supplied to the command. The syntax of id command can be:<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-146 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/2.png\" alt=\"\" width=\"641\" height=\"205\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/2.png 641w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/2-300x96.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/2-65x21.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/2-225x72.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/2-350x112.png 350w\" sizes=\"auto, (max-width: 641px) 100vw, 641px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>User Management<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">In this section, we will learn how to create users, how to modify\/delete the users existing in the system and how to set password to the user. In Linux, the users can be classified into following categories:<\/p>\n<ul>\n<li>Normal users<\/li>\n<li>Root user (super user)<\/li>\n<li>System user<\/li>\n<li>Network user<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">A super user has maximum privileges of the system. Generally, administrator tasks are performed by a super user. It is always advisable not to use the super user account for normal use of the system. A super user has privileges to create groups and create other users. A normal user can deal with tasks like sharing of files over network, printing of files, etc. Depending on the services offered by Linux, a user can further be classified as a system user or network user. In this module, our focus will be to understand how a normal user can perform tasks of a super user with proper authentication. Root privileges are required to perform following task:<\/p>\n<ul>\n<li>Create\/Manager users<\/li>\n<li>Install or remove software packages<\/li>\n<li>Remove or modify system files (config files of \/etc direcroty)<\/li>\n<li>Start\/Stop\/Restart system services (httpd, vsftp, etc.)<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">When we logon to the system, we would be working as a normal user. A normal user gets \u2018$\u2019 prompt, while the super user gets \u2018#\u2019 prompt. When a super user logs in, we call it root access. Below is the command to transit from normal user to super user:<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-147 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/3.png\" alt=\"\" width=\"640\" height=\"313\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/3.png 640w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/3-300x147.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/3-65x32.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/3-225x110.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/3-350x171.png 350w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">We can modify the groups of a user, i.e. add a user to particular group or remove the user from some group using usermod command; we can also lock\/unlock users using the usermod command.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The following are few commands to manage groups. We use groupadd command to create a group, groupmod to modify a group and groupdel to delete a group.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-148 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/4.png\" alt=\"\" width=\"625\" height=\"122\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/4.png 625w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/4-300x59.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/4-65x13.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/4-225x44.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/4-350x68.png 350w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/p>\n<p style=\"text-align: justify;\">The following are few screenshots where we can see how the user is created and how we can assign a user to particular group.<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-149 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/1.jpg\" alt=\"\" width=\"698\" height=\"327\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1.jpg 698w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-300x141.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-65x30.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-225x105.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-350x164.jpg 350w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>Figure 4: User creation<\/strong><\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-150 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1.jpg\" alt=\"\" width=\"595\" height=\"172\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1.jpg 595w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1-300x87.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1-65x19.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1-225x65.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1-350x101.jpg 350w\" sizes=\"auto, (max-width: 595px) 100vw, 595px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>Figure 5: Modifying a user<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">As shown in figure 5, a user student1 is added to the students group. It is to be noted that the group name \u201cstudents\u201d already existed before typing the usermod command.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Operations with root account<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">As we have discussed earlier, root account can be used to perform administrator level tasks. Linux provides two different ways to access root account, they are as follows:<\/p>\n<ul>\n<li>Using su command<\/li>\n<li>Using sudo command<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">It is advisable to use sudo command rather than su command since there are less risks associated if we use the sudo command. In f act, the sudo command is generally used to perform a single task while the su command can be used only when we wish to perform sequence of tasks that require root level access. The following table lists the difference between su and sudo command.<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-152 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1.png\" alt=\"\" width=\"540\" height=\"252\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1.png 540w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1-300x140.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1-65x30.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1-225x105.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/1-1-350x163.png 350w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/p>\n<p style=\"text-align: justify;\">Let us take an example to understand the difference between su and sudo commands. Suppose, there is a requirement to create 100 users in a system, the system administrator can assign the task of user creation to some operator. Now, if he provides password of su to the operator, the operator may gain access to entire system and he can modify config files or can also delete user accounts. So, the solution is that the administrator will give privileges only to create users in root privileges. The administrator will configure sudoers file and will add the operator details such that the operator can perform useradd command as a super user and cannot perform any other command that requires su password. So, the operator will type following command to create users:<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-153 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/111.png\" alt=\"\" width=\"601\" height=\"489\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/111.png 601w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/111-300x244.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/111-65x53.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/111-225x183.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/111-350x285.png 350w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-154 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/222.png\" alt=\"\" width=\"627\" height=\"262\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/222.png 627w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/222-300x125.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/222-65x27.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/222-225x94.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/222-350x146.png 350w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/p>\n<p>The above notation signifies that who(username) will be allowed to access from were(network id) the specific command that requires su privileges. It further says, that the user will be identified as whom (which group) and what kind of command can be performed.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Whenever a user tries to access sudo command, the activity is logged into the system. So, whenever a normal user accesses sudo to acquire root privileges temporarily, the action is saved as log file. In case of misuse, we can check who tried what kind of commands by looking at the log file.<\/p>\n<p>&nbsp;<\/p>\n<p>Access to sudo command and failures are logged into files like<\/p>\n<ul>\n<li>\/var\/log\/auth.log (Debian systems)<\/li>\n<li>\/var\/log\/messages<\/li>\n<li>\/var\/log\/secure<\/li>\n<\/ul>\n<p>A typical message entry will contain:<\/p>\n<ul>\n<li>Date, time and host name<\/li>\n<li>Calling username<\/li>\n<li>Terminal info<\/li>\n<li>Working directory<\/li>\n<li>User account invoked<\/li>\n<li>Command with arguments<\/li>\n<\/ul>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-155 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/222222.jpg\" alt=\"\" width=\"938\" height=\"267\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/222222.jpg 938w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/222222-300x85.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/222222-768x219.jpg 768w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/222222-65x19.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/222222-225x64.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/222222-350x100.jpg 350w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><\/p>\n<p style=\"text-align: center;\"><strong>Figure 6:Entry into a log file<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The above entry in figure 6 shows that a user \u201cDemo\u201d issued sudo command to access useradd command. Since the sudoers file is very important, it can be accessed by issuing \u201cvisudo\u201d command under root privileges.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Environment Variables<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">An environment variable is a named quantity that holds character string. Environment variable contains information that can be accessed by the shell (such as bash) and can be used by one or more applications. Some of the environment variables can be defined by user and some of them are pre-set (built-in) that is provided by the system. The values of environment variables can be accessed by typing set, env or export commands. The set command may behave in a different manner depending on the state of our system. The content of these variables is as follows:<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-156 aligncenter\" src=\"http:\/\/itp7.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/30\/2018\/07\/3333.png\" alt=\"\" width=\"598\" height=\"321\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/3333.png 598w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/3333-300x161.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/3333-65x35.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/3333-225x121.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-content\/uploads\/sites\/30\/2018\/07\/3333-350x188.png 350w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/p>\n<div>\n<p><strong>Few Environment Variables<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Let us see study environment variables that are useful for system administration. HOME is an environment variable that represents the home directory of the user. When we issue the following command , it displays the home (default) directory of the user.<\/p>\n<p>&nbsp;<\/p>\n<p>$ echo $HOME<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">PATH is another environment variable that stores the path of directories that contain executable programs. It is an ordered list of path that is scanned to locate the program\/commands when executed by the user. Each directory stored in the path is separated by colon sign(:). The following command displays the value stored in PATH variable<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">$echo $PATH<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">We can add our home directory in the PATH variable by issuing the following command<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">\u00a0 $PATH=$PATH:\/home\/&lt;user&gt;<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">$echo $PATH<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">PS1 Variable is abbreviation of Prompt Statement and is used to customize the prompt string. PS1 is the primary prompt variable and it controls how the command prompt looks like The following special characters can be included in PS1 :<\/span><\/p>\n<\/div>\n<ul>\n<li>\\u &#8211; User name<\/li>\n<li>\\h &#8211; Host name<\/li>\n<li>\\w &#8211; Current working directory<\/li>\n<li>\\! &#8211; History number of this command<\/li>\n<li>\\d &#8211; Date<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">The environment variable SHELL points to the user&#8217;s default command shell (the program that is handling whatever you type in a command window, usually bash) and contains the full pathname to the shell:<\/p>\n<p>&nbsp;<\/p>\n<p>$ echo $SHELL<\/p>\n<p>\/bin\/bash<\/p>\n<p>$<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Startup Files<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">When a user logs onto the system (shell prompt), the startup files execute automatically (generally bash) . The startup files are used to customize the users environment. It can be used to perform the following tasks:<\/p>\n<ul>\n<li>Define command line shortcuts or aliases<\/li>\n<li>Setting up of the prompt<\/li>\n<li>Setting up default text editor<\/li>\n<li>Setting up the PATH variable to execute custom commands<\/li>\n<\/ul>\n<p><strong>Order of the Startup Files<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">When we first login to Linux, the \/etc\/profile is accessed and evaluated, after which the following files are searched (if they exist) in the listed order:<\/p>\n<ol>\n<li>~\/.bash_profile<\/li>\n<li>~\/.bash_login<\/li>\n<li>~\/.profile<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">If the Linux login shell comes across the first file, it ignores the rest of the file. Which means that if it finds ~\/.bash_profile, it ignores ~\/.bash_login and ~\/.profile. Different distributions may use different startup files.<\/p>\n<p>&nbsp;<\/p>\n<p>Let us summarize the key concepts covered in this module<\/p>\n<ul>\n<li>Concept of users and groups.<\/li>\n<li>User management and related commands.<\/li>\n<li>User environment and environment variables.<\/li>\n<li>Commands for root access like su and sudo.<\/li>\n<\/ul>\n<table>\n<tbody>\n<tr>\n<td><strong>you can view video on User Environment &#38; Local Computer security in GNU\/Linux<\/strong><\/td>\n<td><a href=\"https:\/\/youtu.be\/MeSW7ttYRjM\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>References<\/strong><\/p>\n<ol>\n<li style=\"text-align: justify;\">Tom. Adelstein and Bill. Lubanovic. 2007. <em>Linux system administration<\/em>, O\u2019Reilly.<\/li>\n<li style=\"text-align: justify;\">Sam R. Alapati. 2016. <em>Modern Linux Administration How to Become a Cutting-edge<\/em> <em>Linux Administrator.<\/em>, Oreilly &amp; Associates Inc.<\/li>\n<li style=\"text-align: justify;\">Kirk. Bauer. 2003. <em>Automating UNIX and Linux administration<\/em>, Apress.<\/li>\n<li style=\"text-align: justify;\">Richard Blum. 2008. <em>Linux command line and shell scripting bible<\/em>, Wiley Pub.<\/li>\n<li style=\"text-align: justify;\">M. Carling, Stephen. Degler, and James. Dennis. 2000. <em>Linux system administration<\/em>, New Riders.<\/li>\n<li style=\"text-align: justify;\">Chuck. Easttom and Serge N. Palladino. 2012. <em>Essential Linux administration\u202f: a<\/em> <em>comprehensive guide for beginners<\/em>, Course Technology\/Cengage Learning.<\/li>\n<li style=\"text-align: justify;\">Richard Fox. <em>Linux with operating system concepts<\/em>,<\/li>\n<li style=\"text-align: justify;\">Aeleen. Frisch. 2002. <em>Essential system administration<\/em>, O\u2019Reilly.<\/li>\n<li style=\"text-align: justify;\">el. . . <em>Linux system administration\u202f: a user\u2019s guide<\/em>, Addison-Wesley.<\/li>\n<li style=\"text-align: justify;\">Juliet. Kemp. 2009. <em>Linux system administration recipes\u202f: a problem-solution approach<\/em>, Apress.<\/li>\n<li style=\"text-align: justify;\">Olaf. Kirch and Terry. Dawson. 2000. <em>Linux network administrator\u2019s guide<\/em>, O\u2019Reilly.<\/li>\n<li style=\"text-align: justify;\">Olaf. Kirch and Terry. Dawson. 2000. <em>Linux network administrator\u2019s guide<\/em>, O\u2019Reilly.<\/li>\n<li style=\"text-align: justify;\">Mark (Mark F&#8230; Komarinski, Cary. Collett, and Inc. Red Hat. 2000. <em>Red Hat Linux<\/em> <em>administration handbook<\/em>, Prentice Hall PTR.<\/li>\n<li style=\"text-align: justify;\">Chris Negus. <em>Linux bible<\/em>,<\/li>\n<li style=\"text-align: justify;\">Roderick W. Smith. 2007. <em>Linux administrator street smarts\u202f: a real world guide to Linux<\/em> <em>certification skills<\/em>, John Wiley.<\/li>\n<li style=\"text-align: justify;\">Wale Soyinka. <em>Linux administration\u202f: a beginner\u2019s guide<\/em>,<\/li>\n<li style=\"text-align: justify;\">Vicki. Stanfield and Roderick W. Smith. 2002. <em>Linux system administration<\/em>, Sybex.<\/li>\n<li style=\"text-align: justify;\">Nicholas. Wells. 2000. <em>Guide to Linux installation and administration<\/em>, Course Technology, Thomson Learning.<\/li>\n<li style=\"text-align: justify;\">Matt. Welsh, Matthias Kalle. Dalheimer, Terry. Dawson, and Lar. Kaufman. 2003. <em>Running Linux<\/em>, O\u2019Reilly.<\/li>\n<\/ol>\n","protected":false},"author":4,"menu_order":10,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":["mr-hardik-joshi"],"pb_section_license":""},"chapter-type":[],"contributor":[58],"license":[],"class_list":["post-142","chapter","type-chapter","status-publish","hentry","contributor-mr-hardik-joshi"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/chapters\/142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/wp\/v2\/users\/4"}],"version-history":[{"count":8,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/chapters\/142\/revisions"}],"predecessor-version":[{"id":685,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/chapters\/142\/revisions\/685"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/chapters\/142\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/wp\/v2\/media?parent=142"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/pressbooks\/v2\/chapter-type?post=142"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/wp\/v2\/contributor?post=142"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp7\/wp-json\/wp\/v2\/license?post=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}