Lab 10.1.1: Logging Into Linux Estimated Time: 30 minutes Objective In this lab, the student will learn how to boot a Linux computer, log in as the root user, navigate using the Comman
Trang 1Lab 10.1.1: Logging Into Linux
Estimated Time: 30 minutes
Objective
In this lab, the student will learn how to boot a Linux computer, log in as the root user, navigate using the Command-Line Interface (CLI), and then shut the computer down This lab will cover the following CLI commands:
• su
• man
• ls
Equipment
The following equipment is required for this exercise:
• Computer with Linux Red Hat 7.2 installed
Scenario
The student will boot up the Linux computer and log in using the root user account The student will run Linux in the command line mode and will shut down the system using the Unix-based shutdown command
Trang 2Turn the computer on and observe the boot process When Linux begins to load, the following screen will be displayed This screen gives the user the option of booting into
the text mode Press the Enter key to bypass this screen, or wait and Linux will
automatically begin to boot (in approximately five seconds)
The boot process may take a few minutes The time will vary according to the speed of the computer As Linux boots, the Linux processes will load The screen should look similar to the following as the Linux system boots up
Do these processes make sense?
Trang 4
After Linux is loaded, the user will be prompted to login During the installation process, the Command-Line Interface (CLI) was set as the default boot The screen below shows
a CLI login prompt
The Linux administrator account is called the root account Type in root and press the
Enter key Be careful when typing because like all UNIX computers, Linux is case
sensitive
Next, type in root’s password:
cisco1
Note: the root account is signified by the # at the prompt
Trang 5Step 3
It is not a good practice to work as the root user The root user has complete control of the Linux system and can inadvertently delete important files It is better to work as a user that does not have total control and to switch to the root account only when
maintaining or upgrade the system In Linux, it is a simple process to switch users by using the su command
During the installation process two accounts were created One account was for the root account and another for general student use Students will need to ask the instructor for the student account name
At the command prompt, type:
su - studentA1
Note: When root users are switching users they will not be prompted for a password All
other accounts will be prompted for a password
Did the command prompt change? How?
Note: the “–“ after the su command is called a switch When switching users, this switch
will run all associated user scripts To experiment, type exit after logging in as any user other than the root user The user will end up back as the root user Now type:
su studentA1
This time without the “–“ switch What happened? Did the user end up in studentA1’s
home directory?
Trang 6Make sure to be logged on as a student user To verify this, use the whoami command The whoami command will only display the login name of the current user
At the command prompt type in:
whoami
What were the results?
Trang 7
Step 5
Navigating the Command-Line Interface (CLI) is not difficult if the user knows where to find help In Linux, the man command displays information about CLI commands
For example, to learn about the ls command type in:
man ls
Results of the man ls command
To move around the man screen, click the Enter key to move down
Like DOS, Linux commands may have switches associated with them Note that the ls command uses many switches, -a and –l are the most common
To exit the man command, type the letter:
q The user will return to the CLI
Trang 8At the CLI, type in the following commands Describe the results after each command is entered:
ls
ls –a
ls –al
How are files hidden in Linux?
Hint: What character does Linux place in front of the file to hide it?
Step 7
In this step, using the shutdown command will turn off the computer Linux, like all NOSs, must complete the shut down process Linux needs time to shutdown so it can put files where they belong Turning off a Linux system quickly can result in files being lost and the corruption of vital configuration settings
To learn about the shutdown command, type in:
Trang 9From this man page, briefly describe the shutdown command
What does the –r switch do?
What does the –h switch do?
How is the time set with the shutdown command?
Trang 10
Step 8
Only the root user is allowed to shutdown a Linux computer To complete this step, verify that the user is logged in as the root user If not, type:
su – root
If requested, enter the root password
Next, type:
shutdown –h now
Describe the shutdown process
After the shutdown process was complete, did the computer turn off?
Note: With an ATX power supply it will turn the computer off Older AT boxes will not Troubleshooting
IT professionals are frequently called on to troubleshoot Linux log-in problems The following list can be used as a checklist when troubleshooting:
Problem: Cannot log in to the system
Trang 11• Username or password is misspelled or mistyped Check both the username and password and carefully re-enter this information In both Linux and UNIX, usernames and passwords are case-sensitive, so verify that the password uses the correct case
• Keyboard Caps Lock is on Press the Caps Lock key once, verify that the keyboard
Caps Lock indicator light is off, and try entering the password again
• User has confused username with password Verify that the user is typing his or her
username in the “User name” field, and password in the “Password” field
• When logging in through CLI, some users do not realize that although they do not see anything being entered as they type, the system is taking the input So it is
sometimes common for beginning users to think their machine is frozen at this point Reflection
1 Why is it important to log out or lock the console when leaving it unattended?
2 What are some of the reasons a user may not be able to log in to the server?
3 What advantages does the ability to switch between multiple login terminals provide?