NETW 110 Lab 3 Post-Installation Configuration Page 1

Transcription

1 NETW 110 Lab 3 Post-Installation Configuration Page 1 Objective At the conclusion of this lab, the student will learn some very basic functions of vi, use vi to perform some post-installation configuration duties, and upload and download files using ftp. Finally, you will properly shutdown and reboot Linux. Getting Help You can get help on any command, its syntax, and all options from the man pages. For some basic information on vi, see the handout on editors. Journal Assignment From the man pages and online search, write down information, instructions, and options with respect to UNIX and LINUX for the following commands and definitions: Linux/UNIX runlevels Linux/UNIX boot loaders grub lilo Linux/UNIX change virtual terminals vi inittab ps shutdown reboot halt Overview When we install hardware and software, some configuration files need to be modified. These configuration files are ASCII text files, which are opened in a text editor, modified, and saved. When we are working at the CLI, the typical text editor for Linux/UNIX is vi (which has been replaced by vim). If you have never used vi, see the handout. Now we will practice some very basic editing functions using vi, but first we must download a text file. Based on our installation configuration, Fedora will boot into the GUI (Graphical User Interface or X). Throughout this course, we perform most of our configuration assignments from the CLI (Command Line Interface also know as the text mode). When X is running, there are two ways to get to the CLI quickly. 1. We can start a virtual terminal session in a new Window. To do this: CL on Applications => Highlight System Tools CL on Terminal 2. There are seven shell based Virtual Terminal (VT) sessions (also called Virtual Console sessions). These sessions are accessed by pressing CTRL-ALT-F1 through CTRL-ALT-F6, and one GUI VT, which is accessed by pressing CTRL-ALT-F7. You can start a process that will take a long time in one session, and perform a different function by changing to a different VT. NOTE: During this course, we will configure Linux to boot into the CLI. When Linux boots to the CLI, the session is represented by the F1 key. If you start X from the CLI, F1 will not give you a command prompt until the X session is terminated. If you change to the F1 session, you will see some text on the display that represents the functions that Linux performed to start the X session, and at the bottom of the display, you will probably see a blinking underline. If you press the enter key, it merely inserts a blank line. You should change to a different VT, or change back to the X session.

2 NETW 110 Lab 3 Post-Installation Configuration Page 2 Virtual Terminals In a UNIX/Linux system, you have only one keyboard (terminal), but you have up to six virtual terminals named tty1 through tty6 that operate in the text mode, and tty7, which is the GUI mode. When you system starts in the CLI, you are logging in and operating in tty1. Each virtual terminal uses about 8KB of kernel memory. If this matters, it is easy to allocate fewer virtual terminals. In the Linux 2.4 kernel, virtual terminals are created on demand, so not starting mingetty on the virtual terminal will not create the virtual terminal. mingetty is designed to be a minimal getty for the virtual terminals on the workstation's monitor and keyboard. It has no support for serial lines. If the machine does not have a video card then remove all the mingetty entries from /etc/inittab. The six mingetty s are created in your inittab file with the lines: # Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6 By pressing a function key F1 through F6 with CRTL-ALT, you are changing to the virtual terminal that corresponds to the number of the function key (F1 through F6 starts tty1 through tty6 respectively) When you are operating in X, you can also perform tasks at the CLI by opening a terminal window in X by CL on Red Hat Applications, CL on System Tools, CL on Terminal You can start a new virtual terminal at the CLI by pressing CTRL-ALT-F2 This started tty2, and you will now receive a standard login prompt. You can now login as any user for which you have logon privileges. When you startx, the CLI prompt and cursor in tty1 is no longer present as a process is running, and you are operating in tty7, the first terminal device after the six text consoles. You can logout of a virtual terminal by entering the command exit. The system login prompt returns. You can now change to any other virtual terminal. If you opened a virtual terminal and X is running, you can return to X by pressing CTRL-ALT-F7 Procedure Using a Text Editor 1. Boot Linux and login with your general user account. Make a directory in your /home/username called lab02 with the command mkdir lab02 Make a directory in /home/username called lab03 with the command mkdir lab03 2. Start a browser, the web browser. Open the NETW110 website on the class server by entering the address Place the mouse over the link for text.txt and CR From the menu, CL on Save Link Target As Save the file in your /home/username directory as text.txt 3. Start a Virtual Terminal session in a new window by:

3 NETW 110 Lab 3 Post-Installation Configuration Page 3 CL on Applications Highlight System Tools CL on Terminal Enter the command vi text.txt There are six lines of text similar to the following: The name of this file is text.txt When you type ussing an edior, you may often make a mistoke that you have to correct. vi will allow you to correct the the problem, get rid of the bad stuff, and make your life easy. This is the first line of the text. As you can see, there are a number of typographical errors. Change to the insert mode and make the following corrections: Line Error Correction 2 using misspelled delete one s 2 edior misspelled editor insert a t between the i and the o 2 two spaces between the comma and before you delete the extra space 3 mistoke mistake 4 the the delete extra the We have finished with the corrections. Now we will make some changes. Move to the last line of text, change to the command mode, and press dd Move to the first line of the file and press p Copy the first six lines to the buffer (from the first line press 6yy ) Create 10 blank lines at the end of the file and Paste the buffer contents. Save the file as editor.txt and exit View the contents of the file cat editor.txt If the file is correct, copy the file to the lab03 directory with the command: cp editor.txt lab03/. Note: the destination filename in the previous line is lab03 slash dot with no spaces. If this gives you a problem, use cp editor.txt lab03/editor.txt Assigning root privileges to your general user account. Login as root Change to the /etc directory Enter the command visudo The contents of the screen is similar to the following: # sudoers file. # # This file MUST be edited with the 'visudo' command as root. # # See the sudoers man page for the details on how to write a sudoers file. # # Host alias specification # User alias specification

4 NETW 110 Lab 3 Post-Installation Configuration Page 4 # Cmnd alias specification # Defaults specification # User privilege specification root ALL=(ALL) ALL # Uncomment to allow people in group wheel to run all commands # %wheel ALL=(ALL) ALL # Same thing without a password # %wheel ALL=(ALL) NOPASSWD: ALL # Samples # %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom # %users localhost=/sbin/shutdown -h now Press I. Move to the end of the line that states root ALL=(ALL) ALL Press enter and add the following line yourusername ALL=(ALL) ALL where yourusername is your general username. Press Escape, write and quit. Copy the file /etc/sudoers to /home/lab03/sudoers motd When users login in, you can display a message. It is called the message of the day (even though it does not automatically change.) It is the same regardless of how a user logs in. The file is automatically created in /etc with the name motd when the OS is installed, but it is blank so no message is displayed. We will now modify the file. Since the original version of the file is blank, there is no need to make a backup copy. You must be logged in with root privileges. Login as the superuser with the command su, and enter the root password. Change to the /root directory. Copy the kickstart configuration file created anaconda when you installed Fedora with the command: cp anaconda-ks.cfg to /home/username/lab02/ks.cfg Change to the /etc directory Enter the command: vi motd Press i Press the enter key three times to insert 3 blank lines. Press the space bar 7 times and enter in the text Warning. Access to this system is limited to authorized users. Press the enter key and the spacebar until the cursor is directly under the space between the words Access and to and enter the text Trespassers will be persecuted! Press the enter key three times to insert 3 blank lines. Press ESC Write the changes and quit :wq Enter the command clear to clear the display and home the cursor View your motd by entering the command cat /etc/motd

5 NETW 110 Lab 3 Post-Installation Configuration Page 5 If the file is correct, copy the file /etc/motd to /home/username/lab03/. where username is your default username. Default Shell Settings Make sure that you have superuser privileges (login as su). Change to the /root directory Make a backup copy of.bash_profile to.bash_profile.orig Open.bash_profile in vi and change to the insert mode. Add :$HOME the PATH statement as follows: PATH=$PATH:$HOME:$HOME/bin Skip one blank line and add the statement umask 077 Go to the end of the file and add the following lines: alias dir='ls -la less' alias cls='clear' alias copy='cp' Change to the /etc/skel directory Make a backup copy of.bash_profile to.bash_profile.orig Open.bash_profile in vi and change to the insert mode. Add :$HOME the PATH statement as follows: PATH=$PATH:$HOME:$HOME/bin Skip one blank line and add the statement umask 002 Go to the end of the file and add the following lines: alias dir='ls -la less' alias cls='clear' alias copy='cp' Verify the file is correct, and copy the file /etc/skel/.bash_profile to /home/username/lab03/. where username is your default username. Default runlevel Currently, Fedora boots to the GUI (runlevel 5). We are going to change a file that will cause Fedora to boot to the CLI (runlevel 3). If you make an error editing this file, Fedora may not boot, so be careful. You must have superuser or root privileges to access this file. Make a backup copy of inittab to inittab.orig Open inittab in vi and change to the insert mode. Near the middle of the file, you will see a description of the 7 runlevels for Linux. The current default runlevel is 5 (X-WINDOWS). Below the runlevel list in inittab is the id command that looks like the following. id:5:initdefault: We wish to change the default runlevel from 5 to 3 (CLI). Modify this line to read id:3:initdefault:

6 NETW 110 Lab 3 Post-Installation Configuration Page 6 Write the file and quit. Verify the file was changed with the cat command. Verify the file is correct, and copy the file /etc/inittab to /home/username/lab03/. directory where username is your default username. Let us make sure everything is working properly. You should still have root privileges. At the system prompt, enter the command reboot You will see the CLI login prompt. Enter your regular username and password. The screen will now display the motd and your system prompt. Login with your general user account. Failure to boot after Changes made to files It is possible that a typo in one of the files that we just modified. It is also possible that we may not be able to login as root or su because we forgot the root password, or another su changed the password and did not tell us. In either case, we need to boot to runlevel 1 so we can fix the problems. We do this by interrupting the grub bootloader and force a boot to the single user mode (runlevel1). TO do this: Reboot or start the system. When you see the warning that you have 5 seconds to interrupt the boot process Press the Enter key Press e From the grub menu, press e Press the down arrow Press e From the end of the line press the backspace and delete rhgb quiet Type the text single and press the Enter key Press b After much text goes by, you are logged in as root without providing the password, and you should see the prompt sh-3.00# You can now perform any functions on any file that you would do under a normal boot. To change the root password, enter the command passwd If you could not boot due to a typo in a critical file and you made a backup copy before you edited the file, you can restore the original file by changing to the directory and copying the backup version of the file (we used the same filename and added a.orig extension at the end) over the original file. For example: cp filename.orig filename If asked do you wish to overwrite, say y or yes. When you are finished, you can boot to the default runlevel by pressing CTRL-D Final Steps The handout of using ftp from the CLI explains the procedure to use ftp to upload and download files. For now, we will just give you instructions to upload the files that you just created and modified. Your default login and password is your server name (ie login apple and password apple). You should change your password upon connection.

7 NETW 110 Lab 3 Post-Installation Configuration Page 7 Even though the files are in your username directory, they are owned by root since they were created and copied by su. In order for you to access them under your general username, you must change the ownership of the files. Make sure that you have su privileges. Change the ownership of all the files in the lab02 and lab03 directory (recursively) to your general username (ie apple:apple) chown R username:username /home/username/lab02 chown R username:username /home/username/lab03 You can now exit from su From the CLI, enter the command to connect to the class server using secure shell: ssh You will receive a server response The authenticity of host ' ( )' can't be established. RSA key fingerprint is 37:76:a4:6a:ad:88:84:7f:19:81:67:06:ca:cb:e2:03. Are you sure you want to continue connecting (yes/no)? Enter yes At the prompts for login and password, use your servername (apple) for both. Change your password to something appropriate by entering the command!passwd Close the ssh session with the command exit From the prompt, enter the command to connect to the class ftp server: ftp At the login prompt, use your servername (apple) for the login and your new password Your prompt is ftp> On the ftp server, make a directory named lab02 and lab03 Upload all the files from your /home/username/lab02/ directory to your lab02 directory on the server. (mput /home/username/lab02/ lab02/.) Upload all the files from your /home/username/lab03/ directory to your lab03 directory on the server. (mput /home/username/lab03/ lab03/.) Verify that all files were uploaded to the server. When you are finished, logoff with the command bye Shutdown from the CLI Note: In the lab, it is not necessary to shutdown the system at the end of class. However, you should logoff by entering the command exit After you exit, you will see a login prompt. In the real world, you should never remain logged on with root privileges. You should logoff by entering the command exit as soon as you have finished your tasks. After you exit, you should see your user prompt. For security reasons, anytime you plan to leave the area, you should exit even from you general user account. Once again, just enter the command exit Occasionally, it is necessary to shutdown the computer for routine maintenance. This could be a system backup, installation of new hardware, etc. You should be logged in at runlevel3 as a generaluser. Login as su since you will not be allowed to shutdown the server without root privileges. Enter the command shutdown r 15 to reboot in 15 minutes and send a broadcast message to all users. The message is similar to the following: Broadcast message from root (tty1) (Thu May 20 10:02: )

8 NETW 110 Lab 3 Post-Installation Configuration Page 8 The system is going DOWN for reboot in 15 minutes! Notice that you have no prompt. Press CTRL-C to abort the shutdown. You should receive the message Shutdown Cancelled, and the CLI prompt is back. If you use h instead of r, the system will shutdown and halt instead of reboot. If you use now instead of 15, the system would send a message and shutdown immediately. Any logged on users would loose their connection and perhaps files might be lost or corrupted. You might have some very angry users visit your office. To include your own message, you can enter the command: shutdown h 15 The system will be shutdown for routine maintenance for 3 hours. These will shutdown the system in 15 minutes and immediately send the broadcast message: Broadcast message from root (tty1) (Thu May 20 10:02: ) The system will be shutdown for routine maintenance for 3 hours. The system is going DOWN for system halt in 15 minutes! Every minute, a broadcast message informs all users how long until shutdown. Cancel the shutdown with the command CTRL-C You could type halt does the same thing as shutdown h now Also, you could enter the command init 0 To restart the system, you could type reboot, which is equivalent to shutdown r now. An appropriate broadcast message is displayed. You could also reboot using the command init 6 Both halt and reboot are all immediate commands. They send appropriate Broadcast messages, but do not give you a chance to change your mind. Finally, you can reboot by pressing CTRL-ALT-DEL (known as the Vulcan Neck Squeeze and the three finger salute), which is equivalent to shutdown r now

Information These notes were originally written in the year 2000 as part of a set of LPI Exam 101 training materials. The LPI training course at Bromley College was subsequently discontinued and some of

Operating Systems and Systems Integration Administration, the root User and Configuring sudo 1 Aim The aim of this activity is to understand the purpose of the root account, and the security risks of logging

Operating Systems and Systems Integration Using grub to Boot various Operating Systems Contents 1 Aim 2 2 What You Will Do 2 3 Background 2 3.1 Installing grub in MBR from a floppy, and from the OS........

CHAPTER 2 This chapter describes the CLIs you use to configure the Catalyst 4500 series switch. This chapter includes the following major sections: Accessing the Switch CLI, page 2-1 Performing Command-Line

Console Redirection on VMware ESX Server Software and Dell PowerEdge Servers October 2005 Notes, Notices, and Cautions NOTE: A NOTE indicates important information that helps you make better use of your

Basic File Attributes The UNIX file system allows the user to access other files not belonging to them and without infringing on security. A file has a number of attributes (properties) that are stored

CHAPTER 19 Managing Users, Managing Security The heart of Linux security is determining who can use what file and what kind of use is permitted. This is not all there is to making Linux a more secure system,

CHAPTER 2 This chapter describes the CLIs you use to configure the Catalyst 4500 series switch. This chapter includes the following major sections: Accessing the Switch CLI, page 2-2 Performing Command-Line

Using PICO on Central UNIX SYNOPSIS This chapter provides a summary of the basic pico commands. Basic operations such as cursor movement, inserting and deleting text, and searches are covered to give the

0Handouts: Optional Lab 1-1: Understanding the /etc/securetty file In this lab, you will examine a PAM component, the /etc/securetty file. 1. Boot into Linux as root. Open a Telnet client and attempt to

CHAPTER 5 This section describes how to configure the Cisco NAM 2220 appliance to establish network connectivity, configure IP parameters, and how to perform other required administrative tasks using the

Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit A portion of this lab is to be done during the scheduled lab time. The take-home programming assignment is to be turned in before the next lab;

Getting Started With UNIX Lab Exercises This is the lab exercise handout for the Getting Started with UNIX tutorial. The exercises provide hands-on experience with the topics discussed in the tutorial.

SSH Secure Shell Client 1 Introduction An SSH Secure Shell Client is a piece of software that allows a user to do a number of functions. Some of these functions are: file transferring, setting permissions,

Using WestGrid from the desktop Oct 11 2007 on Access Grid Introduction Simon Sharpe, UCIT Client Services The best way to contact WestGrid support is to email support@westgrid.ca This seminar gives you

Using the Zoo Workstations Version 1.86: January 16, 2014 If you ve used Linux before, you can probably skip many of these instructions, but skim just in case. Please direct corrections and suggestions

TEL2821/IS2150: INTRODUCTION TO SECURITY Lab: Operating Systems and Access Control Version 1.0, Last Edited 09/20/2005 Name of Students: Date of Experiment: Part I: Objective The objective of the exercises

3 HOW LINUX BOOTS You now know the physical structure of a Linux system, what the kernel is, and how to work with processes. This chapter teaches you how the system starts (boots) that is, how the kernel

Automatically Logging on a User at Linux System Boot time for Console Management This document can be found on the web at www.ibm.com/support/techdocs Search for author s name under the category of White

Physics REU Unix Tutorial What is unix? Unix is an operating system. In simple terms, its the set of programs that makes a computer work. It can be broken down into three parts. (1) kernel: The component

LAB #5 Intro to Linux and Python on ENGR 1. Pre-Lab: In this lab, we are going to download some useful tools needed throughout your CS career. First, you need to download a secure shell (ssh) client for

CHAPTER 8 Managing Controller Software and Configurations This chapter describes how to manage configurations and software versions on the controllers. This chapter contains these sections: Transferring

2 Answers to Exercises 1. Briefly, what does the process of installing an operating system such as Fedora/RHEL involve? When you install an operating system such as Fedora/RHEL, you copy operating system

Working with the Linux Shell CHAPTER 2 In this chapter you will learn about How the Linux shell works Using the shell prompt Getting help for Linux shell commands Working with environment variables Working

Post Ubuntu Install Exercises PacNOG 3 June 18 Rarotonga, Cook Islands 1. Get used to using sudo 2. Create an ainst account 3. Learn how to install software 4. Install gcc and make 5. Learn how to control

This material is based on work supported by the National Science Foundation under Grant No. 0802551 Any opinions, findings, and conclusions or recommendations expressed in this material are those of the

Lecture-4 Introduction to Unix: More Commands, Boot-up Actions and X Window What You Will Learn We continue to give more information about the fundamental commands of the Unix operating system. We also

Linux Exercise The following steps will guide you through the most common Linux commands. If you are using windows (Library and any Windows lab on campus), then start with step 1. If you are using a linux

Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various

CODD SERVER ACCESS INSTRUCTIONS OVERVIEW Codd (codd.franklin.edu) is a server that is used for many Computer Science (COMP) courses. To access the Franklin University Linux Server called Codd, an SSH connection

APP-J: WHAT IS APPLICATION JUKEBOX? Use Application Jukebox (App-J) to run University software on any Windows PC or laptop. Launch apps from the Application Jukebox web page Install the Application Jukebox

Oxford University Computing Services Getting Started with Unix Unix c3.1/2 Typographical Conventions Listed below are the typographical conventions used in this guide. Names of keys on the keyboard are

IT 341 Introduction to System Administration Project I Installing Ubuntu Server on an Virtual Machine Here we create a new virtual machine and install Ubuntu 12.04 LTS Server on it. In this instance, we

CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C Welcome! Welcome to your CpSc 111 lab! For each lab this semester, you will be provided a document like this to guide you. This material, as

14. Configuring Telnet in Knoppix Estimated Time: 45 Minutes Objective In this lab, the student will learn how to configure the Telnet service on a system so that the user can remotely administer a Knoppix

Introduction to Linux Workshop 1 The George Washington University SEAS Computing Facility Created by Jason Hurlburt, Hadi Mohammadi, Marco Suarez hurlburj@gwu.edu Logging In The lab computers will authenticate

Linux Survival Guide Introduction: This guide is intended for use with classes at DACC that use a Linux operating system as the platform for students. It provides a quick summary and examples of how to

Text Editing in UNIX A short introduction to vi, pico, and gedit Copyright 2006 2009 Stewart Weiss About UNIX editors There are two types of text editors in UNIX: those that run in terminal windows, called

Introduction This document explains how to use the CD-ROM bootable version of Linux, named Knoppix, to make and restore images of computer hard drives. Knoppix makes a very good system recovery tool for

This is Worksheet and Assignment 12 This is a combined Worksheet and Assignment.. Quizzes and tests may refer to work done in this Worksheet and Assignment; save your answers. You will use a checking program

CHAPTER 1 The command-line interface (CLI) is a line-oriented user interface that has a set of commands for configuring, managing, and monitoring the CSS. To help you use these commands, this chapter provides

Information About, page 1 How to Use the CLI to Configure Features, page 5 Information About Command Modes The Cisco IOS user interface is divided into many different modes. The commands available to you

Introduction to Linux Mukesh Pund Principal Scientist, NISCAIR, New Delhi, India History In 1969, a team of developers developed a new operating system called Unix which was written using C Linus Torvalds,

202 Lab Introduction Connecting to the Lab Environment Objectives During this v7.1 Deployment lab, each student (from the Blue group or Green group) must verify access (and permissions) to their assigned

IT 341 Introduction to System Administration Project I Installing Ubuntu Server on an Virtual Machine Here we create a new virtual machine and install Ubuntu 16.04 LTS Server on it. In this instance, we

InDepth Linux Serial Consoles for Servers and Clusters The more Linux servers you're responsible for, the more that serial consoles can save you money, space and headaches by easing remote administration

1 2 a) Login to the system b) Use the appropriate command to determine your login shell c) Use the /etc/passwd file to verify the result of step b. d) Use the who command and redirect the result to a file

Tiny Instruction Manual for the Undergraduate Mathematics Unix Laboratory 1 Logging In When you sit down at a terminal and jiggle the mouse to turn off the screen saver, you will be confronted with a window

System Administration Terminals and the X Window System Terminals: Then and Now "In the old days": real serial terminals Common now: "Virtual Terminal" on monitor In both cases, a tty "TeleTYpe" a text