Exercise 1 - Creating a new user and group

Mon, 08/06/2012 - 18:13 -- ross

Hi All,

A couple of people asked for some exercises to get comfortable with using the command line, so here's exercise number 1. It should be fairly easy.

Goal 1: Create two different users one named "guest" and one named 'nohome' (You should also end up with a groups 'guest' and 'nohome'. The 'guest' user should have a home directory just like your regular user, but the 'nohome' user should not have a home directory.

Goal 2: Switch to your guest user (you will want to use the 'su' command for this) and create a file in the guest's home directory called "temporaryfile.txt" which includes the text "Hello World!".

Goal 3: Change the ownership of the file "temporaryfile.txt" so that it's owned by the 'nohome' user and 'guest' group. (You will need to be root to change file ownership.)

Goal 4: From the home directory of the guest user, run

ls -l

and paste the output to paste.debian.net. Then post your pasted url to a blog page on poctechies.net with any thoughts or questions you have about the process.

Your pasted output should look like this:

guest@virilio:~$ ls -l
total 4
-rw-r--r-- 1 nohome guest 13 Aug 6 17:54 temporaryfile.txt

Goal 5: Return the temporaryfile.txt back to guest user and guest group ownership.

All of these steps can be accomplished from the command line. The relevant pages in the Essential Linux Adminstriation book are as follows:

  • User info page 93 and 97. You may also want to review this link about the 'su' command
  • Group ownership info page 106
  • That's all for exercise number 1. Good luck and I look forward to seeing your pasted output!