Hands-On Lab User Groups and Accounts Tasks
Hands-On Lab User Groups and Accounts Tasks
Adding Users 1
Adding Groups 2
Create Folders 3
Group Ownership 3
File Ownership 4
Removing a User 5
Review 5
User Groups and Accounts Tasks
This lab covers how to create user groups and then manage those groups by assigning them
account tasks, folders, and other privileges.
Once we sign in to the instance, we need to change some of the login information, specifically
the password information. To do so, use your preferred text editor.
Change the maximum amount of days a password can be used, the minimum amount of days
allowed between password changes, the minimum password length, and the number of days
that a warning is provided before the password expires. To do this, we’ll be using the i command
to insert the new values. We’ll be changing the MAX to 60, length to 10, and WARN to 10. Note
that you can make these whatever you want, we’re just using these numbers for this example.
PASS_MAX_DAYS 60
PASS_MAX_DAYS 0
PASS_MIN_LEN 10
PASS_WARN_AGE 10
Adding Users
With the password parameters set, we will now move on to adding our new users. For our
example, we are using usernames that are only five characters long. Usernames can be longer
or shorter than this, but we will only be using five. While adding the users, we will use the
comment field, -c, when adding the user’s name.
We can make sure the users have been added by doing the following command:
-1-
User Groups and Accounts Tasks
Now that we have confirmed our users have been added, we need to provide each user with a
password. Make sure to copy down these passwords for yourself as you will need them later in
the lab. Note that if we try to use simple passwords like password, it will not be accepted.
To check that passwords have been added to each user, we’re going to use tail to review the
/etc/shadow file:
Adding Groups
With our users added it’s time to create groups for them. We will be adding three different
groups; marketing, sales, and creative.
-2-
User Groups and Accounts Tasks
Create Folders
Now that we have groups we need folders for those groups. We’ll be making three folders, one
for each group.
Group Ownership
Now that we have the groups, we want to make sure that the groups own their corresponding
files. To check who owns what, we need to look at the group’s directory:
All folders will show that they are owned by root. To have them owned by the correct group, we’ll
make use of the recursion flag, -R:
Once everything is set, use ll to check that ownership is now set to the corresponding group
instead of root:
[root@linuxacademy ~]# ll
drwxr-xr-x. 2 root creative $DATE $TIME creative
drwxr-xr-x. 2 root creative $DATE $TIME marketing
drwxr-xr-x. 2 root creative $DATE $TIME sales
-3-
User Groups and Accounts Tasks
File Ownership
Now that the folders are completed, we want to make sure that any files made in the folders
keep the same ownership as the folder:
[root@linuxacademy ~]# ll
drwx-rwsr-x. 2 root creative $DATE $TIME creative
After adding them, review that they have been added to the correct groups:
With everyone set in their groups, it’s time to go poke around in the folders and check that
everyone has the correct permissions. To do that, we’ll need to log in as a user. For now, let’s
practice with the username ustyl:
-4-
User Groups and Accounts Tasks
We can now see that ustyl is the owner and that they are in the sales folder. Now have ustyl try
and create a file in another folder.
ustyl should get a message that he cannot create the file. This lets us know that we have set
the file permissions up correctly. You can repeat this with one of the other users as well just to
be sure.
Removing a User
Before removing a user, make sure to use exit to logout and return to the root user. Once
you’re root again, then we can begin removing a user. Again, we’ll use ustyl as our example. We
will delete and then review our users to make sure that ustyl was removed.
Review
After completing this lab, you are now able to add users, groups, folders, and then connect
those folders back to the users and groups created; as well as delete users. Congratulations on
completing this lab!
-5-