Gain knowledge and experience in how passwords are stored and permissions set in Linux.
There are three pieces of information to be submitted: the password information (/etc/shadow), group members (/etc/group) and listing of files/directories for the users. To obtain the listing, as network user run:
network@node1:~$ sudo ls -lR /home/ > /home/network/listing.txt
Then archive and compress the files into a single file called submit-ID.tgz:
network@node1:~$ sudo tar czvf submit-ID.tgz /home/network/listing.txt /etc/group /etc/shadow
Now use OpenSSL to sign the file submit-ID.tgz using SHA1 (using your key pair from Homework 2), saving the signature as sign-ID.bin.
Submit the two files submit-ID.tgz and sign-ID.bin on Moodle.
If you submit correctly and have create the files and set permissions correctly, you will get full marks for this homework. Even if there are some mistakes in your permissions on files, you can get full marks. In this homework I will not be checking all of the permissions you set in detail, nor will I be checking that you understand the password information (I will assume you do understand if you submit). However there may be questions in the exam related to these tasks.
When I receive your submissions I will verify the signature, unpack the files and then take a quick look at the three files to see the users/groups you have created and the permissions you have set.
In a new virtnet node do the following:
Create a new user called username:
network@node1:~$ sudo adduser username
Create a new group called groupname:
network@node1:~$ sudo addgroup groupname
Add a user called username to the group called groupname:
network@node1:~$ sudo adduser username groupname
Switch to another user called username:
network@node1:~$ su username
Read the manual (help) page for a command, e.g. for adduser:
network@node1:~$ man adduser
Open a text file in an editor (e.g. /etc/passwd, /etc/shadow). You can also use this to create a new file.
network@node1:~$ nano filename
Some files/operations are restricted for the admin users (including the user called network). To access these files or perform these operations, precede the command with sudo:
network@node1:~$ cat /etc/shadow
cat: /etc/shadow: Permission denied
network@node1:~$ sudo cat /etc/shadow
root: ....
Create a new directory called dir:
network@node1:~$ mkdir dir
View the contents of directories:
network@node1:~$ ls -l
Set the mode (permissions) for a file called filename (or directory):
network@node1:~$ chmod mode filename
where mode is formatted as: SubjectOperationPermission. Subject includes: u, g, o, a. Operation includes: +, -, =. Permission includes: r, w, x. E.g.
Change the user owner and group owner of a file (or directory) to be user username and group groupname:
network@node1:~$ chown username.groupname filename
For example:
network@node1:~$ ls -l abc.txt
-rw-rw-r-- 1 sgordon sgordon 428 Sep 20 16:37 abc.txt
network@node1:~$ chown sgordon.faculty abc.txt
network@node1:~$ ls -l abc.txt
-rw-rw-r-- 1 sgordon faculty 428 Sep 20 16:37 abc.txt
An example from last year (which was a similar task) is described in detail here.