Assignment 2 - Linux commands
Assignment 2 - Linux commands
Fulvio Risso
http://fulvio.frisso.net
1
The problem
◼ Create a short video (no more than 5 minutes, MPEG4 format) showing the steps
below without using the GUI (only through a “terminal”)
◼ Then, upload the resulting video on Telegram
3
Tasks: #1 - Playing with files and folders
◼ 1) Create a structure such as the following:
\home\ttpu\parent1\child1\file1.txt
|
\child2\file2.txt
|
\child3\file3.txt
4
Tasks: #2 - Playing with permissions
◼ 1) Create a new user called “testuser”
◼ 2) Modify the permissions of “file2.txt” so that it can be written only by user
“testuser” (and show that it behaves as expected)
◼ 3) Modify the permissions of folder “child3” so that only user ”testuser” can go into
that folder (and show that it behaves as expected)
◼ 4) Remove all the folders and files you have created without becoming “superuser”
(Hint: you can either “impersonate” the second user, or login as the second user)
◼ 5) Show that user “testuser” cannot become “root” (i.e., it cannot use the “sudo”
command) (Hint: start the “tcpdump” program, which requires admin privileges)
◼ 6) Change the permissions to user “testuser” by adding him to the “sudoers” group
and show that now it can run privileged applications
\home\ttpu\parent1\child1\file1.txt
|
\child2\file2.txt
|
\child3\file3.txt
5
Tasks: #3 - Playing with processes and applications
◼ 1) start “htop” and determine (1) the number of CPU cores and the RAM of your
machine, (2) which are the applications that consume more resources
◼ 2) install the “tree” program (to show content of files and folders in a “tree” way)
◼ 3) show the content of “parent1” with “tree” (i.e., “tree parent1”)
◼ 4) install the “netstat” program (to show some network statistics)
◼ 5) type the “netstat -an” program and check that the TCP port 80 is actually used by
someone (likely, your webserver)
◼ 6) Check that “nginx” webserver is actually running in your system (suggestion: use
“ps”)
6
Tasks: #4 - Playing with the network
◼ 1) Copy file “/var/www/html/index.nginx-debian.html” into
“/var/www/html/index.html” and modify the text as you like
◼ Suggestions: (1) move in the target folder; (2) copy file (and pay attention to
permissions!); (3) use “nano” to edit
◼ 2) Open a browser and type “http://localhost” in the address bar
◼ See that the previous file is visible and can be opened
◼ 3) Start another VM and verify that the previous file is visible (hint: pay attention to
the IP address you have to use)
◼ 4) From the second VM, start an “ssh” connection toward the first machine, and log-
in as “testuser”, showing that now you can log-in from remote