Professional Documents
Culture Documents
https://linuxacademy.com/cp/exercises/view/id/63...
Live Show and Giveaway! (/cp/live/info) Help & Questions meyerjp
Navigation
Return to Syllabus (/cp/modules/view/id/1)
Note: This exercise can be completed on a LinuxAcademy.com lab server. However, some of the solutions
are specific to Debian/Ubuntu servers.
1. Start your Linux Academy server and login. Create two users, 'john and jeff'. Set their passwords and
login as both.
[root@localhost]# useradd -m jeff && useradd -m john
[root@localhost]# passwd jeff && passwd john
(&& means only perform the following command if the first one completed successfully)
2. Change the root password on your system to 'linuxtest'. Log out and log back in as root. Remove the
user 'user' from the system, including the removal of /home/user. Note: in order to do this you will need to
be sure to be logged into the system with your new user account. Do not use the user "user" or you will not
be able to remove the user account.
Type su to change the user to root
[root@localhost]# passwd
[root@localhost]#logout
log back in to the root user by typing su on the command line
root@localhost]# userdel -r user (this will remove the user, user, and the users home directory)
3. Lock the user account added previously called 'john' and log out and verify the account can no longer
access the system. Create two new groups called 'lagroup1 and lagroup2'. Execute a command that will
add the account 'jeff' to both those groups. Use ONE command to add that account to both groups.
Open a new terminal/putty screen and connect to your server. Login as your user and then "su" into the
root user. You will now have two terminals, one for your root user to perform actions and one to test locking
users out.
From your root terminal type: passwd -l john. From your other terminal attempt to login to the system with
the user "john". You will notice it will not allow it. Now from your root terminal type "passwd -u john" and try
to login again. You will notice login is now allowed.
[groot@localhost]#groupadd lagroup1 && groupadd lagroup2
[root@localhost]#usermod -aG lagroup1,lagroup2 jeff
1 of 4
11/10/2015 20:44
Linux Academy
https://linuxacademy.com/cp/exercises/view/id/63...
4. Add the user 'jeff' to the appropriate place so that user has the ability to execute commands with super
user/root privileges. While logged in as the user 'jeff', create a small text file with any content in the /root
directory.
As the root user edit /etc/sudoers. If /etc/sudoers does not exist you need to install sudo "apt-get install
sudo" or "yum install sudo".
You can use visudo to edit the /etc/sudoers file but for certification reasons you should know how to edit
the file manually.
Add jeff to the sudoers file, you can do this one of two ways.
Add the user directly in the file jeff
ALL=(ALL)
ALL
Make sure the "wheel" option is not commented out and exists %wheel
ALL=(ALL)
NOPASSWD:
ALL if the wheel option is available we would then add jeff to the wheel group (% represents "group") at the
command line type "usermod -aG wheel jeff".
Debian/Ubuntu users might notice "sudo" and not "wheel" is the default group. You can use that in place of
wheel.
Log out of the system then log back in as jeff. As the jeff user type "sudo touch file /root/test" without
quotes. This will create a file in the /root directory which only root can do.
5. Create a new directory in root's home directory called 'filemaintenance'. Change to that directory and
create three "dummy files", "file1", 'file2", and "file3". Move back to the parent directory (root's home
directory) and then copy the files located in filemaintenance to your home directory.
[root@localhost]# cd; mkdir filemaintenance (just typing cd will change you to your home directory)
[root@localhost]# cd filemaintenance; touch file1; touch file2; touch file3 (create three files in your home
directory)
[root@localhost]# cd ..
[root@localhost]# cp filemaintenance/* . NOTE THE . it is part of the statement and means "current
directory" (This command will copy all the files, directories and sub directories in /home/youruser
/filemaintenance directory into your /home/youruser directory (the filemaintenance parent directory)
6. Change back to your home directory root. Move the new 'filemaintenance' directory and all its contents
into another directory called 'movedfiles'
[root@localhost]# cd
[root@localhost]# mkdir movedfiles
[root@localhost]# mv filemaintenance/ movedfiles/
7. Log out of your system. Attempt to log in to the system three times using the recently locked user
account 'john'. After the third failed attempt, log into your system as root. List the last 10 lines of the
appropriate log file on the system that will show those failed login attempts.
If logged in then logout and attempt to login to the system with the "wrong" password three times
Log back into the system. Some systems use different auth logs now depending on your distribution and
version distribution it will be one of the log files listed below
tail /var/log/auth.log OR tail /var/log/syslog OR tail /var/log/secure
8. Logged in as a user with super user privileges, search the filesystem for a configuration file called
'ld.so.conf' and display its location and path. List the contents of that file piped to a second file called
'ld.so.conf.out' in your home directory.
Use locate to find the file.
[root@localhost]# updatedb - if the command is not found then apt-get install locate or yum install locate
2 of 4
11/10/2015 20:44
Linux Academy
https://linuxacademy.com/cp/exercises/view/id/63...
3 of 4
11/10/2015 20:44
Linux Academy
https://linuxacademy.com/cp/exercises/view/id/63...
Back
4 of 4
Mark as Completed
11/10/2015 20:44