Home > Articles

Linux Administration and Configuration

This chapter is from the book

This chapter covers the following testing objectives for Novell Course 3015: Novell Nterprise Linux Services:

  1. Manage the Linux file system.

  2. Manage Linux network interfaces.

  3. Manage Linux applications.

Managing Linux Users and Groups

Test Objective Covered:

  1. Manage the Linux file system.

In the previous chapter, you were introduced to the Linux file system. In this chapter, we will explore that file system in more depth and specifically focus on how Linux keeps information in the file system secure.

Linux File System Security

Recall from earlier discussions that Linux is a multiuser operating system. When you installed your SUSE Linux server, you created two users: root and student. You could also create many other users. Depending on how the system is utilized, you could even have dozens or even hundreds of users.

This is a very powerful aspect of Linux, but it also presents some problems. Suppose you have four users on your system—root, Kimberly, Josh, and Jessica—and each user had full access to all the files on the system. Kimberly uses the Linux system to edit digital video, which involves using very large files. Josh uses the system to prepare reports and spreadsheets—very small files in comparison to Kimberly's.

When Josh logs in, he notices that the system is low on disk space and decides to clean off some files. Of course, he doesn't want to delete any of his own files, so he probes through the file system looking for entries owned by other users and notices that that some of Kimberly's files are over 12GB in size. Josh feels that these files are obviously wasting space and decides to delete them.

Josh also probes into the /usr/bin directory and decides to delete some of the files found there as well. Who needs files with funny names such as "grep" and "dig" anyway?

Imagine how Kimberly feels when she logs back in, only to find her video files gone. Imagine how root feels when it is discovered that some administration files are missing. This is definitely not good.

Windows and Multiple Users

If you use an older version of Microsoft Windows, such as Windows 95 or 98, this is exactly the situation you could encounter. These operating systems allow you to create individual user accounts. Each user, however, has full access to every file in the file system, including the operating system files. This presents a challenge for many system administrators.

To reduce expenses, many companies with multiple employee shifts assign users in different shifts to use the same workstation. All too often, the day-shift employee arrives to find that the swing- or night-shift employee had deleted his or her files.

Later versions of Windows, such as Windows 2000 and XP, rectified this problem by allowing the administrator to create user accounts that don't have access to system files and that can't access other users' files.

To prevent this situation, Linux implements a file system security system that uses the following components:

  • Users

  • Groups

  • Permissions

  • Ownership

Each of these components are explored in the following sections.

Linux Users

As with other multiuser operating systems, Linux uses user accounts. During the installation of a Linux system, one user account is always created by default: root.

The root user account has full access to the entire system. Anyone logged in as root can open, modify, copy, or delete any file in the file system. This user account has a great deal of power and must always be used with discretion.

As mentioned earlier in this book, you should never log in as root to perform routine, day-to-day work. This rule prevents two problems. First, it eliminates the possibility of someone using your root account to wreak havoc on your system while you're away from your desk. Second, it keeps you from accidentally wreaking havoc on your own system. I'll explain why later in this chapter.

For these reasons, you should always log in as a regular system user to conduct your normal tasks on the system. When you need root-level access, use the su – command at the shell prompt to switch to the root account. When you're done, be sure to switch back to your regular account with the exit command at the shell prompt.

Most Linux installation routines provide you with the ability to create one or more regular user accounts during installation.

TIP

Some Linux distributions will require that you create at least one regular user account during installation.

After installation, you can use YaST2 on a SUSE system to create new user accounts. If you're working from within GNOME or KDE, just select Applications, SUSE Menu, System, YaST2.

When you do, the YaST Control Center appears. Select Security and Users and then select Edit and Create Users. The User and group administration screen appears, as shown in Figure 3.1.

Figure 3.1Figure 3.1 Creating new users in YaST.

TIP

If you are working within a nongraphical session, you can enter yast2 at the shell prompt.

To create a new user, select Add. To modify an existing user, select Edit. To delete an existing user, select Delete.

In a Linux system, user account information is saved in the passwd file located in /etc. A typical passwd file is shown in Figure 3.2.

Figure 3.2Figure 3.2 User accounts in the passwd file.

Notice that the passwd file is composed of lines of information. Each line represents a single user account record. Seven individual pieces of information appear on each line (or record). These are called fields and are delimited by a colon (:) character. The fields, in order, are as follows:

  • User name—This is the name the user enters to log in to the system.

  • Password—Notice that each account appears to have a password of "x"." That's because the passwd file doesn't actually contain the user's passwords. This will be explained in more detail later.

  • User ID—This is a number assigned by the system to each user account. Each User ID is unique on the system. No two users can have the same ID.

  • Group ID—This is the ID number of the group the user is a member of. Multiple users can be members of the same group and, hence, have the identical Group ID numbers.

  • Full name—This is the user's full name. This parameter is optional.

  • Home directory—This is the path to the user's home directory in the file system.

  • Shell—This is the default type of shell that will be presented to the user.

If you look closely at Figure 3.2, you'll notice that each user account appears to be assigned a password of x. That's because user passwords aren't actually stored in the passwd file.

To prevent this, user passwords are stored in encrypted format in the shadow file located in the /etc directory. A typical shadow file is shown in Figure 3.3.

Figure 3.3Figure 3.3 User passwords in the shadow file.

CAUTION

It is possible to install your Linux system such that passwords are stored in the passwd file. Depending on the Linux distribution you are using, you should be presented with a screen during installation that asks if you want to shadow your passwords (or text to that effect). You should always use shadow passwords. If you don't, they'll appear in the passwd file.

Notice in Figure 3.3 that, like the passwd file, each line in the shadow file represents a user record. Each user record has nine fields delimited by colons:

  • User name—This is the same name as is used in the passwd file.

  • Password—This field contains the user's encrypted password.

  • Last change—This field lists the date when the password was last changed.

  • Minimum days—This field lists the minimum number of days the user can have the same password.

  • Maximum days—This field lists the maximum number of days the user can have the same password.

  • Warning—You can configure the system such that users are prompted a couple days before their password expires. This field lists the number of days prior to expiration that the warning is displayed.

  • Allow inactive—You can configure the system such that users can still log in for a couple days after their password has expired. This field contains the number of days this is allowed.

  • Expires—This field lists the date that the user's password will expire.

  • (Unused field)

To change these values on a SUSE system, you can use YaST. Access the Edit and Create Users option and select the user you want to modify. Then select Edit, Password settings. The screen shown in Figure 3.4appears.

Figure 3.4Figure 3.4 Modifying user password settings.

Look closely at the record for the root user account. Notice that the password appears to be a complex string of characters. This is actually the password in encrypted form. The root password on this system is actually novell. Because of this, you shouldn't directly edit the shadow file with a text editor. You should use a system utility such as YaST to change a user's password.

Linux Groups

Not only does Linux differentiate accounts by user, but it also uses groups. A group is simply a collection of user accounts. At first glance, groups and users may seem somewhat redundant. Groups are very powerful management entities, especially when you're working with a large number of user accounts.

To illustrate, imagine that you have 40 user accounts on a Linux system. All these users need the same permissions to a given set of directories in the file system. Without groups, you would have to manually assign permissions to each user.

TIP

Permissions will be introduced later in this chapter.

With groups, however, you can make all 40 user accounts members of a single group. Then you can assign permissions just once to the group. Each of the members of the group automatically receive the permissions that have been assigned to the group.

As a general rule, you should create groups and assign permissions to them first and add users to those groups. After that, assign individual permissions to specific users who require access differing from that required by other members of the group. The goal is to minimize the number of permissions assigned directly to individual user accounts.

For example, suppose you have 40 users who all need the same level of system access. You can create a group for these users, assign permissions to the group, and make the 40 users members of the group. Further, suppose that one of the 40 users needs additional access beyond that provided by the group. You can then assign additional permissions to that individual user.

Managing your system in this manner can greatly decrease your administrative workload. Suppose you have the 40-user system mentioned previously and you install a new application on the system. Each user needs access to the files for that application. If you use groups to manage access, you simply need to make one permission change. If, on the other hand, you chose to assign permissions to each individual user instead of using groups, you need to make 35 changes.

On a 40-user system, that may not sound overwhelming. Instead of 40, however, suppose you administer a Linux system that has several hundred users. The difference in work required to manage permissions becomes much more apparent.

When working with groups, you should keep in mind a couple important points. First, only two users can change groups assigned to a file or a directory and the associated permissions: root and the file/directory owner.

Second, you can't have a user account that isn't assigned to a group. Each and every user must be a member of at least one group. On a SUSE Linux system, every user is made a member of the users group, by default, when the user account is created.

In Figure 3.5, user rtracy has just been created. You can see that rtracy was made a member of the users group along with the student account we created during the installation of the system.

Figure 3.5Figure 3.5 New users automatically added to the users group.

It's important to note that users can be members of more than one group. Users can switch to a different group (and receive the permissions of the new group) by entering newgrp new_group_name at the shell prompt. When they do, they'll be prompted to supply the new group's password, discussed next.

Group information is stored in the group file located in the /etc directory. This file is shown in Figure 3.6.

Figure 3.6Figure 3.6 Groups in the group file.

Just like the passwd and shadow files, each line in the group file represents a record for an individual group. The fields within the record are delimited by colons. The fields in the group file include the following:

  • Group name—This field contains the name of the group.

  • Password—You can, optionally, require that members of this group supply a password when switching to the new group.

  • Group ID (GID)—The GID is a unique number assigned to the group.

  • Group members—This field lists users who are assigned as members of the group.

You probably noticed that, like in the passwd file, an x represents passwords in the group file. If you configured your system to use shadow passwords during installation (and you should), group passwords are saved in the gshadow file in the /etc directory. A typical gshadow file is shown in Figure 3.7.

Figure 3.7Figure 3.7 Group passwords in the gshadow file.

In Figure 3.7, a sample group named test was created and assigned a password of novell. You'll notice, however, that the text of the password in the file appears to be random characters.

Just as with the shadow file, passwords in the gshadow file are encrypted. Because of this, you shouldn't try to use a text editor to edit the gshadow file to change or add a group password.

If you need to manage the groups on your SUSE Linux system, you can use the YaST utility. Select Applications, SUSE Menu, System, YaST2.

When you do, the YaST Control Center appears. Select Security and Users, Groups Administration, Edit and Create Groups. The screen shown in Figure 3.8 appears.

Figure 3.8Figure 3.8 Managing groups in YaST.

If you want to add a new group, select Add. If you need to modify an existing group, select the group and then select Edit. If you need to delete a group, select it and then select Delete.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020