LinuxBasics.org

The community that helps people to run Linux

rss
Table of Contents

Chapter 2 Comments on Exercises Section 2.5

2.5.1. Connecting and disconnecting

4. Log in again, using a non-existent user name
→ What happens?

The logon box shakes horizontally as to say no. Then the message “Authentication failed. Letters must be typed in the correct case.” Then the box is ready for a username input. (Debian. Behaviour might vary with distros).

2.5.2. Passwords

Log in again with your user name and password.
1. Change your password into P6p3.aa! and hit the Enter key.
→ What happens?

The shell requests: “Retype new UNIX password:”

If the retyping is the same as the first typing, the shell says: “passwd: password updated successfully”.

If the retyped password is different as the first typing, the shell says: “Sorry, passwords do not match.”

2. Try again, this time enter a password that is ridiculously easy, like 123 or aaa.
→ What happens?

The shell replies: “Bad: new password is too short.”

3. Try again, this time don’t enter a password but just hit the Enter key.
→ What happens?

The shell replies: “No password supplied.”

4. Try the command psswd instead of passwd
→ What happens?

The shell replies: “Bash: psswd: command not found”

New password

Unless you change your password back again to what it was before this exercise, it will be P6p3.aa!. Change your password after this exercise! Note that some systems might not allow to recycle passwords, i.e. restore the original one within a certain amount of time or a certain amount of password changes, or both.

2.5.3. Directories

These are some exercises to help you get the feel.

1. Enter the command cd blah
→ What happens?

The shell replies: “Bash: cd: blah: No such file or directory

2. Enter the command cd ..
(Note the space between cd and ..)
Use the pwd command.
→ What happens?

The directory is changed to user@computer: /home$

3.List the directory contents with the ls command.
→ What do you see?

I see my user directory

→ What do you think these are?

The computer users. In this case, only mine.

→ Check using the pwd command.

/home

4. Enter the cd command.
→ What happens?

The Bash prompt changes to
user@computer:~$
which is the user’s home directory (indicated by the ~). (The default symbol for the user’s home varies across distributions).

5. Repeat step 2 two times.
→ What happens?

Nothing more. cd always brings me back to the user’s home.

6. Display the content of this directory.

ls

7. Try the command cd root
→ What happens?

The bash shell replies: ”bash: cd: root: No such file or directory"

St.W.: This seems to be an error in the book. I assume that Mechtelt (the original Author) wanted us to change to the root-directory, which is written as single forward slash. So let me rephrase:

7.1. Try the command cd /
→ What happens?

The prompt changes to
user@computer:/$

→ To which directories do you have access?

On Ubuntu, as regular user I found that I have access to all directories! I would have expected that at least /root would be off-limits!

stw@notebook:~$ cd /
stw@notebook:/$ ls
bin    dev   initrd          lib         mnt   root  SRV  usr      vmlinuz.old
boot   etc   initrd.img      lost+found  opt   sbin  sys  var
cdrom  home  initrd.img.old  media       proc  srv   tmp  vmlinuz
stw@notebook:/$ cd /bin
stw@notebook:/bin$ cd /boot
stw@notebook:/boot$ cd /cdrom
stw@notebook:/cdrom$ cd /dev
stw@notebook:/dev$ cd /etc
stw@notebook:/etc$ cd /home
stw@notebook:/home$ cd /initrd
stw@notebook:/initrd$ cd /lib
stw@notebook:/lib$ cd /lost+found/
stw@notebook:/lost+found$ cd /media/
stw@notebook:/media$ cd /mnt
stw@notebook:/mnt$ cd /opt
stw@notebook:/opt$ cd /proc
stw@notebook:/proc$ cd /root
stw@notebook:/root$ cd /sbin
stw@notebook:/sbin$ cd /srv
stw@notebook:/srv$ cd /SRV
stw@notebook:/SRV$ cd /sys
stw@notebook:/sys$ cd /tmp
stw@notebook:/tmp$ cd /usr
stw@notebook:/usr$ cd /var
stw@notebook:/var$ cd

8. Repeat step 4.
Do you know another possibility to get where you are now?

cd ~

2.5.4. Files

1. Change directory to / and then to etc. Type ls; if the output is longer than your screen, make the window longer, or try Shift+PageUp and Shift+PageDown.

The file inittab contains the answer to the first question in this list. Try the file command on it.
→ The file type of my inittab is …..

/etc/inittab: ASCII English text

2. Use the command cat inittab and read the file.
→ What is the default mode (runlevel) of your computer?

(Not every distribution has this file. Ubuntu Edgy Eft doesn’t.)

In OpenSuse-

# The default runlevel is defined here

id:5:initdefault:

3. Return to your home directory using the cd command.

4. Enter the command file .
→ Does this help to find the meaning of .?

5. Can you look at . using the cat command?

6. Display help for the cat program, using the –help option. Use the option for numbering of output lines to count how many users are listed in the file /etc/passwd.

2.5.5, Getting Help

5. Try man or info on cd.
→ How would you find out more about cd?

man bash It is a built-in command… meaning built into the shell.


Home


Copyright (c) by the authors.
This section of the wiki is licensed under the terms of the GNU Free Documentation License.
See the LBook-licensing page for details.


Linux® is a registered trademark of Linus Torvalds.


 
  course/book/anskey_02.txt · Last modified: 2008/07/20 19:08

LinuxBasics.org

Start Linux-Course Tutorials Linux Links Security Blog Forum E-mail List Search Online Chat

Site-Info

Help Get in Touch Making of LBo

Wiki-Control

Powered by

Linux Apache DokuWiki Mailman RUTE ht://Dig