Unix System Administration

Total Page:16

File Type:pdf, Size:1020Kb

Unix System Administration

CS302 SUPPLEMENT

UNIX SYSTEM ADMINISTRATION

David J. Powers

12-May-04

2nd Edition © 2004 Table of Contents

1.0 Linux Installation (Redhat V9.0) 1.1 Image or Filesystem 1 1.2 Image or Filesystem 2

2.0 The Command Line and Shells 2.1 Introduction 2.2 Commands 2.3 Special Variables 2.4 Special Keys 2.5 Special Files 2.6 Redirection 2.7 Pipes 2.8 Shell Metacharacters 2.9 Resources

3.0 Processes 3.1 Terminal Processes 3.1.1 Starting a Process 3.1.2 Ending a Process 3.1.3 Process and Job Control Commands 3.2 Boot & Init Process 3.2.1 Boot Process 3.2.2 Important Boot Files 3.2.3 Init Process 3.2.4 List of Startup Scripts

4.0 Files and Devices 4.1 File System Table 4.2 File System Hierarchy 4.3 File Search Paths 4.4 Device Files 4.5 File Attributes 4.5.1 File Entry 4.5.2 File Permissions 4.5.3 File Types 4.6 Commands 4.6.1 File System Commands 4.6.2 File Directory Commands 4.6.3 File Commands

5.0 User Accounts 5.1 Commands 5.2 Special Files 5.3 Adding a User Manually

6.0 Editors (pico, emacs, vi) 6.1 pico

- 2 - Table of Contents (continued)

7.0 Time Scheduled Commands 7.1 at command 7.2 cron daemon 7.2.1 General Information 7.2.2 Commands 7.2.3 User cron file 7.3 Command output 7.4 Uses for cron and at

8.0 FTP – File Transfer Protocol 8.1 General Information 8.2 Logging On 8.3 Commands 8.4 Logging Off

9.0 Web Server (Apache) 9.1 General Information 9.2 Log Files 9.3 Resources

10.0 Mail Server (Sendmail) 10.1 General Information 10.2 Sending Mail 10.3 Receiving Mail

11.0 NFS – Network File Ssystem 11.1 General Information 11.2 Setting up a Network 11.3 Setting up an NFS Server 11.4 Setting up an NFS Client 11.5 Commands 11.6 Special Files

12.0 X11 - X Window Server 12.1 General Information 12.2 vnc Remote Desktop 12.3 Commands 12.4 Exporting your Display

13.0 Samba 13.1 General Information 13.2 Commands 13.3 Setting up a Samba Connection

14.0 Printing 14.1 General Information 14.2 Commands 14.3 Installation 14.3.1 System Settings -- Printing 14.3.2 Web

- 3 - Table of Contents (continued)

15.0 Scripting 15.1 General Information 15.2 Shell Programming in Bash 15.3 Sample Scripts

16.0 Installing Software Packages 16.1 Installing Software Packages 16.2 Adding/Removing Standard Redhat Applications 16.3 Resources

17.0 Linux Resources 17.1 MAN pages 17.2 Web pages

18.0 Rebuild Linux Kernel

APPENDIX A Utility Commands B Secure Shell (ssh) and Putty C Summary of Network Services

Glossary

- 4 - 1.0 Linux Installation (Redhat 9.0)

1.1 Image or Filesystem 1

Steps: 1. Boot from Redhat 9.0 CD-ROM (you may have to change BIOS Setup)

2. Use the following options: ● press to install in graphical mode ● Skip Media Check for CD-ROM ● Select appropriate language, keyboard and mouse (for example, 2 Button PS/2 Mouse) ● Perform a New Redhat Linux Installation ● Select Workstation ● Manually Partition Disk into 3 partitions: Delete all old partitions and then add (New) the following partitions:

Partition Mount Point Type Format Size

/dev/hda1 / ext3 √ 8000 /dev/hda2 /user2 ext3 √ 8000 /dev/hda3 swap √ 800

● Select Next to use Grub Boot Loader ● Use DHCP for networking ● Select No Firewall ● Set your root password ( you must remember this! ) ● Make a boot disk (floppy disk) ● Configure monitor and video card (take defaults) ● Select Exit and the system will reboot

3. After the system reboots: ● Create a user account ● Set the date and time ● Test the sound card and speakers ● Answer no to "Register System" ● Answer no to "Additional CD's"

- 5 - 1.0 Linux Installation (continued) 1.2 Image or Filesystem 2

Steps: 1. Boot from Redhat 9.0 CD-ROM (you may have to change BIOS Setup)

2. Use the following options: ● press to install in graphical mode ● Skip Media Check for CD-ROM ● Select appropriate language, keyboard and mouse (for example, 2 Button PS/2 Mouse) ● Perform a New Redhat Linux Installation ● Select Workstation ● Manually Partition Disk and change /dev/hda2 from /user2 to /, select Continue in warning popup, and answer Yes to format (for swap and /dev/hda2).

Use the Add and Edit options to set your partitions as follows:

default √ imagename1 /dev/hda1 (Add) imagename2 /dev/hda2 (Edit)

● Select Next to use Grub Boot Loader ● Use DHCP for networking ● Select No Firewall ● Set your root password ( you must remember this! ) ● Make a boot disk (floppy disk) ● Configure monitor and video card (take defaults) ● Select Exit and the system will reboot

3. After the system reboots (select imagename2) : ● Create a user account ● Set the date and time ● Test the sound card and speakers ● Answer no to "Register System" ● Answer no to "Additional CD's"

- 6 - 1.0 Linux Installation (continued) 1.2 Image or Filesystem 2

4. Edit the following files:

● /boot/grub/grub.conf (Image 2)

default=1 timeout=10 splashimage=(hd0,1)/boot/grub/splash.xpm.gz title imagename2 root (hd0,1) kernel /boot/vmlinuz-version ro root=/dev/hda2 initrd /boot/initrd-version.img title imagename1 root (hd0,0) kernel /boot/vmlinuz-version ro root=/dev/hda1 initrd /boot/initrd-version.img

● /etc/fstab (Image 2) change lines with "LABEL=/" to /dev/hda2 as appropriate

● /etc/fstab (Image 1) $mkdir /image1 $mount /dev/hda1 /image1 $cd /image1/etc

change lines with "LABEL=/..." to /dev/hda1 or /dev/hda2 as appropriate

- 7 - 2.0 The Command Line and Shells

2.1 Introduction When you type a command and press Enter, the command is interpreted by your shell program. Every valid command is either a shell built-in or an external program or script file. Most external commands are located in /bin or /sbin directories. Your default shell is 'bash', the Bourne Again Shell. You can replace Bash by another shell program if you want. Linux shells are case sensitive. Commands must be entered in the proper case.

2.2 Commands

$alias blah='command' make new commands for the session $alias lm='ls -l m*' command lists all files that begin with m $chsh –l list all available shells (from /etc/shells) $chsh –s newshell change shell (updates /etc/passwd) $echo $sh_var display value of a shell variable $exec newshell exits current shell, runs newshell $exec command exit current shell or script and run new command $exit logout $export sh_var=value exports shell variable value to other commands (besides bash) $history display command history $logout logout $newshell runs newshell on top of default shell $printenv display values of all shell variables $set display values of all shell variables

$sh_var=value change the value of a shell variable $A=$PS1 save shell variable value $PS1=$A restore shell variable value

$whereis bash display location of shell and man pages $whereis command display location of command and man pages

- 8 - 2.0 The Command Line and Shells (continued)

2.3 Special Variables

BASH_ENV location of .bashrc for current user DISPLAY current display number EDITOR your default editor HOME your home directory MAIL your e-mail inbox file PATH the search path for commands PS1 your normal prompt SHELL your current shell TERM your terminal type

2.4 Special Keys

Tab command completion ● logout when used at shell prompt ● end-of-file when used to end keyboard input (stdin) ↑ (up arrow) scroll through previous commands ↓ (down arrow)

2.5 Special Files (bash shell)

/etc/profile run at login and contains global definitions of environment variables. can edit and add export commands here, such as, export EDITOR=pico (change for all users) ~/.bash_profile run at login and contains user definitions of environment variables. can edit and add export commands here, such as, export EDITOR=pico (change for current user) ~/.bashrc run at login. can edit and add alias commands here, such as, alias lm='ls -l m*' ~/.bash_logout run at logout ~/.bash_history records session commands stdin (0) standard input stdout (1) standard output stderr (2) standard error

- 9 - 2.0 The Command Line and Shells (continued)

2.6 Redirection

$command1 > file1 take stdout for command1 and put into file1 $command1 2> /tmp/errors redirect errors

$command1 >> file1 take stdout for command1 and append to file1

$command1 < file1 use file1 as the stdin for command1

2.7 Pipes

$command1 | command2

take stdout for command1 and use as stdin for command2

for example, $printenv | sort > env.dat

or $command | command > file

- 10 - 2.0 The Command Line and Shells (continued)

2.8 Shell Metacharacters

* wildcard matching 0 or more characters ? wildcard matching a single character [A-M] matching single character in the set A-M [^a] any single character except 'a' $b include value of variable 'b' ~ home directory

2.9 Resources

● help files: $man bash (or any command) $man –k command (list all pages for command) $man 3 printf (show a specific page) $info bash (or any command) $help command (any shell built-in command) $help (list all built-in commands) $command --help (for any command)

● special keys used with man space bar next page b previous page q quit Home 1st page End last page

● web pages: http://www.faqs.org/docs/bashman/bashref_5.html#SEC5

- 11 - 3.0 Processes

3.1 Terminal Processes

3.1.1 Starting a Process

When you type a command and press Enter, the shell executes the command. The command is either a shell built-in or an external program or script file. If the command refers to an external program or script file, then a path must be supplied by the PATH variable, or an explicit path must be given, such as, ./ , for the current directory. Most external commands are located in /bin or /sbin directories. The program or script file must also have execute (x) permission in order to run. You may display the current search paths by issuing the shell command, echo $PATH. You can change the shell search paths by changing the PATH environment variable:

$PATH=newpath:$PATH (or $PATH=$PATH:newpath) $export PATH

While your command is executing, you do not have access to your shell or the keyboard. This process is said to be executing in the foreground. Only one foreground process can be executing in a terminal window.

You can suspend a foreground process by pressing . You can execute a command in the background by ending the command with an &. A suspended or background process is known as a job. Multiple jobs can be initiated from a terminal window. You will have access to your shell and keyboard while background jobs are executing. Background jobs run at a lower priority than the foreground process. Jobs will have an associated job number.

Multiple commands can be run as separate processes, one process, or many concurrent processes as shown below:

$command1;command2;command3 separate processes $(command1;command2;command3) one process $command1&command2&command3 concurrent processes

- 12 - 3.1.1 Starting a Process (continued)

Each process that is started is assigned a process id (PID) number in numeric order starting at 0 (boot loader PID=0, init process PID=1, etc.). Process information and the current status of each process is stored in the directory, /proc . Within the /proc directory, a child directory exists for each process. For example, the path, /proc/1 , contains information about the init process. Other files exist in the /proc directory that contain information about the LINUX OS.

3.1.2 Ending a Process

can be used to stop or kill a foreground process. The kill command is used to terminate background jobs. You can only kill a process after all active disk requests are completed.

3.1.3 Process and Job Control Commands

$bg run a suspended job in the background $dmesg display boot messages $fg bring a background job into the foreground $halt stop the system $insmod mod.o irg=3 port=0x300 insert module into running kernel $jobs display list of jobs $ps display process attributes options: l, a, u, e, x, f $ps augx | grep smb display any process that contains 'smb' $pstree display process tree showing parent-child relationships $reboot stop the system $renice pri PID change running priority of PID $renice pri -u user change running priority of all processes for 'user'. priorities are -20 (high) to 20 (low), and 0 is the default or base priority. $runlevel display the previous and current runlevel $shutdown stop the system $sleep a time delay process $strace trace system calls and signals $suspend suspend the current shell process $top real-time process activity display $trap trap signals received by shell $ulimit display process and file attributes

- 13 - 3.0 Processes (continued)

3.2 Boot & Init Process

3.2.1 Boot Process

1. CPU is rebooted or restarted. 2. The master boot record is loaded from the partition table on the default device (based on BIOS settings) 3. The grub boot loader uses the grub.conf file from the most recent image installed 4. An OS image is selected by the user 5. The Linux OS image is loaded 6. The Linux kernel starts up and initializes its tables. 7. The Linux kernel runs the init process ( /bin/init, PID 1)

To bypass the login process, the user can edit the grub settings in step 3 above as follows: 1. Select a boot image and press the 'e' key for edit. 2. Select the kernel entry and press the 'e' key for edit. 3. remove 'ro' and add 'init=/bin/bash' (kernel entry) 4. press Enter (not Esc) 5. press 'b' for boot. The system will boot up in Bash with a 'init-2.05#' prompt. 6. $mount / -o remount,rw

3.2.2 Important Boot Files

/boot/vmlinux-version uncompressed kernel image /boot/vmlinuz-version compressed kernel image /boot/initrd-version.img ram-disk image /var/log/messages boot messages /boot/grub/grub.conf boot loader config file (a sample with 2 OS images) default=1 timeout=10 splashimage=(hd0,0)/boot/grub/splash.xpm.gz title Dave root (hd0,0) kernel /boot/vmlinuz-2.4.20-8 ro root=/dev/hda1 initrd /boot/initrd-2.4.20-8.img title Fred root (hd0,1) kernel /boot/vmlinuz-2.4.20-8 ro root=/dev/hda2 initrd /boot/initrd-2.4.20-8.img

- 14 - 3.2.2 Important Boot Files (continued)

Commands can be entered manually at the grub prompt, grub> The commands would include root, kernel, initrd, boot, etc. Commands would have to be entered manually if the grub.conf file was not found or contained errors.

3.2.3 Init Process

1. init is the parent of all processes and cannot be killed.

2. init Run levels:

0 -- halt

1 -- single user mode

2 -- multi user mode -- no networking

3 -- multi user mode -- networking included

4 -- unused

5 -- X11 and the xdm manager (normal level)

6 -- reboot

- 15 - 3.2.3 Init Process (continued)

3. init config file: /etc/inittab (syntax "id:runlevels:action:process" )

"id" is a unique one or two letter id

"runlevels" tells which runlevels this action happens to

"action" describes the action to be taken

1. respawn -- process gets restarted whenever it terminates (but never more than 10 times in 2 minutes) 2. wait -- process will be started at the runlevel and init WAITS FOR IT TO FINISH. 3. once -- process will be started once. 4. boot -- process will be run on booting 5. bootwait – combination of boot and wait 6. powerwait, powerfail, powerokwait -- power loss options 7. sysinit – system initialization

"process" is a program to run

4. Your can change the runlevel while the system is running by using the 'telinit n' command where n is the runlevel. This must be done using root privileges. The runlevel can also be changed by editing the 'id:n' entry of the /etc/inittab file. The change will take effect on the next reboot.

- 16 - 3.2.3 Init Process (continued)

5. Startup scripts

● On bootup or telinit, /etc/rc.d/rc gets called with one arg, the runlevel.

● init looks inside /etc/rc.d/rc${RUNLEVEL}.d

● init runs any "kill" scripts found in there with argument "stop"

● init runs the kill scripts in /etc/rc.d/init.d for locks found in /var/lock/subsys

● init runs the startup script found in /etc/rc.d/rc${RUNLEVEL}.d with argument "start" for processes not found in /var/lock/subsys

● init can re-init a subsystem with /etc/rc.d/init.d/SCRIPT restart

● order of scripts matters -- networking before network file service -- all scripts are run in alpha order

● we rarely write or delete scripts -- normally we just link and unlink from rc${RUNLEVEL}.d to scripts as found in /etc/rc.d/init.d This works great for the automatic insertion and deletion of packages. A script file can be added to /etc/rc.d/init.d

● there is also an /etc/rc.d/rc.local for custom stuff, and an /etc/rc.d/rc.sysinit for once-on-boot stuff

● the scripts are run in the following order rc.sysinit kill scripts in alpha order (KnnSCRIPT) start scripts in alpha order (SnnSCRIPT) rc.local

- 17 - 3.2.3 Init Process (continued)

5. Startup scripts (continued)

● most scripts have the following four (4) options start start a process stop kill a process restart stop and then start a process status status of the process

for example, $/etc/rc.d/rc5.d/S10network status

● the kill and start scripts are soft links to the actual scripts for example when displaying files with the 'ls –l' command: KnnSCRIPT1 -> ../init.d/SCRIPT1 SnnSCRIPT2 -> ../init.d/SCRIPT2

the soft links are set up as follows: $ln –s ../init.d/SCRIPT1 KnnSCRIPT1 $ln –s ../init.d/SCRIPT2 SnnSCRIPT2

for example, $cd /etc/rc.d/rc5.d $ln -s ../init.d/httpd S92httpd

the soft links can be removed as follows: $rm KnnSCRIPT1 $rm SnnSCRIPT2

- 18 - 3.2.4 List of Startup Scripts

Startup scripts are stored in the directory, /etc/rc.d/init.d/ Many of these scripts are used to start and stop daemons.

Names Description aep1000 anacron apmd atd autofs bcm5820 crond command timer cups common unix printing system firstboot functions gpm halt httpd web server (Apache) iptables irda isdn kdcrotate keytable killall kudzu named netfs network network server nfs nfslock nscd ntpd pcmcia portmap postgresql pxe random rawdevices rhnsd

- 19 - 3.2.4 List of Startup Scripts

Names Description saslauthd sendmail e-mail server single smb samba server snmpd snmptrapd squid sshd secure shell server syslog tux vncserver vsftpd very secure ftp winbind xfs xinetd ypbind yppasswdd ypserv ypxfrd

- 20 - 4.0 Files and Devices

4.1 File System Table ( /etc/fstab )

The fields of this table are as follows: field # 1: device name 2: name for mounting point 3: file system type 4: options 5: device number 6: logical unit number of the device

Sample fstab file:

/dev/hda1 / ext3 defaults 1 1 none /dev/pts devpts gid=5,mode=620 0 0 /dev/hda2 /fred ext3 defaults 1 2 none /proc proc defaults 0 0 none /dev/shm tmpfs defaults 0 0 /dev/hda3 swap swap defaults 0 0 /dev/hdc4 /mnt/zip auto noauto,owner,kudzu 0 0 /dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0 /dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0 bine:/share /tmp/share nfs defaults 0 0

The last entry is a shareable folder from host "bine". bine needs to be running when the local workstation is booted.

A filesystem can be mounted as part of the current filesystem as follows:

$mkdir /fred create a mount point #mount device mount_point $mount /dev/hda2 /fred /dev/hda2 is the other filesystem /fred is a directory in the current filesystem -or-

$mount bine:/share /tmp/share bine:/share is a shareable folder on the remote filesystem $cd /tmp/share /tmp/share is a directory in the local filesystem

- 21 - 4.2 File System Hierarchy

/ root directory bin external system commands boot boot files, grub files dev device files etc system and config files home user directories initrd lib library files lost+found lost files misc mnt mountable devices opt optional software packages proc process and system information root root user directory sbin system admin. tools and utilities tftpboot boot files tmp temporary files

usr user files bin user commands dict doc documentation for tools and utilities etc games games include C/C++ header files lib user library files libexec local/sbin local software executables and data sbin system admin. tools and utilities share architecture independent data files share/man manual pages src LINUX source code tmp temporary files X11R6 X window files

- 22 - 4.2 File System Hierarchy (continued)

var variable system data cache db empty ftp gdm lib local lock log mail names nis opt preserve run spool/mail/user incoming mail tmp tux www yp

- 23 - 4.3 File Search Paths

File search paths are either absolute or relative. An absolute pathname begins with a / (the root directory). Pathnames that do not begin with a /, are relative pathnames.

4.4 Device Files

The device names for all the system devices are contained /dev Device special files represent either 'b' block or 'c' character devices. For example, /dev/null is the null device. It is a convenient device to write to when the output does not need to be saved. The device, /dev/zero, contains all zeros.

$cat my.au > /dev/audio make some sound

$mknod make block or char. special file $mknod /dev/psaux c 10 1 make character device with major # = 10 and minor # = 1 Note: you normally do not need to do this. Device special files are automatically generated during system installation.

/proc/ioports a table of i/o port addresses in use by the devices in the system a sample entry, d400-d41f: Realtek Co. d400-d41f: ne2k-pci

/proc/interrupts a table of device interrupt levels (irq) a sample entry, 11: 363979 XT-PIC eth0

PARIDE - parallel ide device

- 24 - 4.5 File Attributes

4.5.1 File Entry

The fields for a file listing are as follows: field # 1: file type and permissions 2: hard link count 3: owner name 4: group name 5: file size in bytes or major number, minor number for a device special file 6: timestamp (date and time) 7: filename

Sample file listing from 'ls –l' command:

lrwxrwxrwx 1 dave dave 4 Apr 28 13:12 bin -> /bin drwxrwxrwx 2 dave dave 4096 Apr 12 10:10 html -rw-rw-r-- 1 dave dave 518 May 4 09:03 input.c brw-rw---- 1 root disk 3, 9 9 Jan 30 2003 hda9

- 25 - 4.5.2 File Permissions

The basic file permission types are 'r' for read, 'w' for write, and 'x' for execute. Permissions are assigned for the user (u), for group members (g) and for everyone else or others (o). File permissions can be changed by using the 'chmod' command. For example,

$chmod a+x file1 gives all users execute permission

$chmod [augo][+-][rwx] filename

Three are 3 special file permission bits:

● SUID set user id bit affects the execution permission of the user (means run as the owner, not as the user) ● SGID set group id bit affects the execution permission of the group

● sticky bit affects the execution permission of others

Execute permission (x) is required to run a file (program or script file). The execute permission for a directory is required to search the directory. Write permission (w) for a directory is required to create or delete files in that directory.

The 'umask' command is used to set the file permission mask. The default file permissions are 777 - mask for an executable file and 666 - mask for a text file. If the mask is 022, then the file permissions are 755 for an executable file and 644 for a text file.

4.5.3 File Types

From filename field . current directory .. parent directory .name hidden file

From first character of permissions field - ordinary file b block device c character device d directory l symbolic link p pipe

- 26 - 4.6 Commands

4.6.1 File System Commands

$df display file systems $du disk usage $fsck scan disk or filesystem $mount mount device $sync flush filesystem buffers $umount unmount device

To copy a file, pico, from the floppy disk to the /usr/bin directory: $mount /mnt/floppy $cp /mnt/floppy/pico /usr/bin $umount /mnt/floppy

4.6.2 File Directory Commands

$cd change directory $dirs list remembered or pushed directories $mkdir make a new directory $popd pop directory $pushd push directory $pwd present working directory $rmdir delete directory

4.6.3 File Commands

$bunzip2 uncompress a .bz2 file $bzip2 compress a file, make a .bz2 file $cat concatenates files or display file $chmod change file permissions $chown change file owner (root command) $cmp compare two files $cp copy files $cp –r * /mnt/floppy copy files to floppy $cp /mnt/floppy/* ~/* copy files from floppy $cut select fields from each line of file $dd convert and copy a file $dd if=/dev/random of=/dev/audio $dd if=/dev/zero of=/dev/audio $dd if=/dev/sda of=/dev/sdb $diff find differences between two files $file determine file type $find dir -name pattern find files matching pattern

- 27 - 4.6.3 File Commands (continued)

$grep search file contents $grep –v text file list all lines in file that do not contain text $gunzip uncompress a .gz file $gzip compress a file, make a .gz file $head display top of file $less display file page by page $more Space Bar – next page B – previous page, Q – quit

$ln link files $ln –s file nickname soft link to file $ln file1 file2 hard link, 2 names refer to same file (file2 is linked to file1) $ls list files $ls -a list hidden files also $mv move or rename files $rm delete files $rm -rf /tmp delete all files in /tmp and any subdirectories without delete confirm $sed stream editor $size lists section sizes for object files $sort sort file $tail display bottom of file $tar archive files $tar -zcf ~/bak.tar.gz . archive and compress all files in the current directory $tar -zxf ~/bak.tar.gz ~/backups uncompress and untar the archive file into the ~/backups directory $tee output to files and stdout $command | tee file1 output to file1 and stdout $touch change the file timestamp $tr translate characters $ls | tr a-m A-M translate a-m to upper case $uniq remove dup lines from sorted file $wc line, word and byte count for file $which command shows the path for a shell command $zcat display a compressed file $zcmp compare two compressed files $zdiff find differences between two compressed files $zmore display a compressed file

- 28 - 5.0 User Accounts

5.1 Commands

$adduser user_name add user $chown user_name:group_name file(s) change the user name and group name for a file $groupadd -g gid group_name create a new group $groupdel group_name delete a group $groupmod modify a group $groups user_name display the groups a user is in $newgrp group_name log in to a new group $passwd user_name change user password. Assumes root if no user_name is given. $pwck verify integrity of password files $su user_name changes the current user $userdel user_name delete user Note: user directory and files are deleted by issuing the following command from the /home directory, $rm –rf user_name $usermod modify a user account $whoami display current user

5.2 Special Files

/etc/passwd login_name:x:userid:groupid:user_info:home_dir:login_shell userid = 0 for root

/etc/shadow login_name:encryp_passwd:12329:0:99999:7:::

/etc/group login_name:x:groupid:

/etc/gshadow login_name:!!:: or login_name:!::

- 29 - 5.0 User Accounts (continued)

5.3 Adding a User Manually (not using the adduser command)

1. add an entry to the end of the /etc/passwd file pinky:x:601:601:Pinky Smith:/home/pinky:/bin/bash 2. add an entry to the end of the /etc/shadow file (* means no password) pinky:*:12330:0:99999:7::: 3. $passwd pinky (enter new password) 4. add an entry to the end of the /etc/group file pinky:x:601: 5. add an entry to the end of the /etc/gshadow file pinky:!:: 6. $mkdir /home/pinky 7. copy default directory files from /etc/skel $cp –r /etc/skel/.bash* /home/pinky $cp –r /etc/skel/.emacs /home/pinky $cp –r /etc/skel/.gtkrc /home/pinky 8. change ownership of files from root:root to pinky:pinky $chown –R pinky:pinky /home/pinky

- 30 - 6.0 Editors (pico, emacs, vi)

6.1 pico

● pico does not use the mouse, only the keyboard

● Setting pico as the default editor $export EDITOR=pico

This command can be added to .bash_profile for the current user or added to /etc/profile for all users (system wide).

● pico commands ^ (Ctrl) G get help ^X exit pico ^O save to file ^R read from file ^J justify text ^W search text ^Y prev. page ^V next page ^^ set selection mark ^K cut selected text ^U paste text ^C current line and character position ^T spell check

- 31 - 7.0 Time Scheduled Commands

7.1 at command

The at command is used to execute one or more commands at a specified time. This is a good option when the commands only need to be run once.

For example,

$at 12:10 (Enter) will execute the commands at at>command1 12:10 (10 minutes past noon) at>command2 at>

7.2 cron daemon

7.2.1 General Information

The cron daemon is used to execute one or more commands at a specified time. cron is used to run a command(s) multiple times on a periodic basis.

● Daemon: crond

● System Configuration file: /etc/crontab

7.2.2 Commands

$crontab -opt where opt is one of the following -u user -e edit user's crontab -l list user's crontab -r delete user's crontab

- 32 - 7.2 cron daemon (continued)

7.2.3 User cron file

/var/spool/cron/user_name

A cron file is created for a user by the command:

$crontab -e

The format of the cron file is as follows:

field description 1 minutes (0-59) 2 hours (0-23) 3 day of month (1-31) 4 month (1-12) 5 weekday (0-6, Sunday = 0) 6 command to run examples * 12 * * * command run command every minute from 12 noon to 1 pm 0 5 * * 2,4 command run command every Tue and Thur. at 5:00 am

7.3 Command output

Command output is sent to the users mail inbox at /var/spool/mail/user_name

7.4 Uses for cron and at 1. disk/file backups 2. clean disk, delete files 3. log usage

- 33 - 8.0 FTP – File Transfer Protocol

8.1 General Information

● Daemon: vsftpd

● Server root: /etc/vsftpd

● Port 21

● Configuration file: /etc/vsftpd/vsftpd.conf

● Log file: /var/log/vsftpd.conf

8.2 Logging On (using ftp client)

$ftp remote_hostname (remote host must have an ftp server running)

when asked for user and password, enter valid (on remote host) user name and password or 'anonymous' user and anything for the password.

- 34 - 8.0 FTP – File Transfer Protocol (continued)

8.3 Commands

file modes: ftp> ascii ftp> binary

affects files on remote host: ftp> mkdir make directory ftp> rmdir remove directory ftp> cd change directory ftp> dir list files in directory ftp> ls list files in directory ftp> pwd list directory ftp> delete delete file

affects files on local host: ftp> lcd change directory ftp> lcd . current local directory

transfer file(s) from local host to remote host: ftp> put file ftp> mput file(s)

transfer file(s) from remote host to local host: ftp> get file ftp> mget file(s)

list all ftp commands: ftp> help

8.4 Logging Off

ftp> quit (or bye)

- 35 - 9.0 Web Server (Apache)

9.1 General Information

● Daemon: httpd

● Server root: /etc/httpd

● Port 80

● Firewalls Web servers are incompatible with firewalls that block their port, usually port 80.

● Configuration file: /etc/httpd/conf/httpd.conf

Note: Backup (make a copy) of this file before making changes. Restart the server daemon (httpd) after making changes.

Important Variables:

DirectoryIndex index.html default web page for host and users DocumentRoot "/var/www/html" web directory for host

#UserDir disable UserDir html web directory for ~user 1. directory and file permissions: ~user 711 html 755 web pages world readable

2. provide directory listing on the web page a. remove comments from httpd.conf file . . b. rename index.html file $mv index.html HEADER.html

- 36 - ● Configuration file: /etc/httpd/conf/httpd.conf

Important Variables (continued):

HostnameLookups Off log ip address and not name Listen 80 port 80 LoadModule foo_module modules/mod_foo.so (refer to Apache modules below)

ServerRoot "/etc/httpd" ServerAdmin root@localhost e-mail address for problems

Other variables exist to change log file options, default language and many other features, such as: 1. min and max number of servers running. check this with the following command, $./S92httpd status 2. setting up CGI scripting 3. virtual hosting 4. changing the icons for various file types 5. associating an extension with a mime type

● magic file: /etc/httpd/conf/magic This file contains default file types

● Other configuration files for httpd can be found in /etc/httpd/conf and /etc/httpd/conf.d

- 37 - 9.1 General Information (continued)

● Apache Modules

An Apache module is an object (shared) module that Apache can load into itself as needed. It's like a DLL or Browser plug-in under Windows. These shared object (so) modules are stored in the /etc/httpd/modules directory.

9.2 Log Files

All web servers make log files. Log files come in three formats: 1. common 2. combined 3. miscellaneous

Generally, logs are too large to analyze by hand. Normally a program or script is needed to process log files.

The system admin person (you) needs to do the following with log files: 1. look at the error log for any serious problems 2. check the access log for system usage 3. use an analysis program (or script) if necessary 4. trim or delete log files periodically. Restart the daemon afterwards.

9.3 Resources

● news.netcraft.com Web server survey info

● www.apache.org/docs/misc/perf-tuning.html performance tips ● ww.apache.org/docs/misc/perf.html

● www.apache.org/docs/misc/howto.html how to info

● www.apache.org/docs/mod/mod_mime_magic.html file type association

● www.apache.org/docs/mod/directives.html documentation for directives

● www.apache.org/docs/misc/security_tips.html security info

- 38 - 10.0 Mail Server (Sendmail)

10.1 General Information

● Daemon: sendmail

● Server root: /etc/mail

● Port 25

● Configuration file: /etc/mail/sendmail.cf

Normally you should not change or edit the sendmail.cf file directly, but rather edit the source file, sendmail.mc, and re-make the sendmail.cf file using the following command: $make –C /etc/mail

Important Variables: 1. 0 DaemonPortOptions=Port=smtp,Addr=localhost, Name=MTA comment this line out with a # in order to receive mail from other hosts 2. DS – "smart" relay host (i.e., popmail.nmu.edu) 3. FR – relay domains file, /etc/mail/relay-domains 4. 0 MaxMessageSize=n

● Other important files:

/var/spool/mail/user_name received mail gets stored here for each user (InBox) ~user_name/dead.letter file containing all mail that can not be delivered ~user_name/.forward used to forward mail (user-w, other-r) Avoid forward loops! /etc/aliases alias names run 'newaliases' command after editing this file /var/log/maillog log file for sendmail

- 39 - 10.1 General Information (continued)

● Sendmail provides a method to send e-mail messages between users. Subject lines are included and messages can be copied to other users. File attachments are not available.

10.2 Sending Mail

$mail user_email_address Subject:

your message goes here!

. to end message Cc:

For example, user_email_address would look as follows:

[email protected] nmu mail address [email protected] Linux workstation address

10.3 Receiving Mail

1. Look in your inbox: /var/spool/mail/user_name

-OR-

2. $mail –u user_name

This command will retrieve messages for the user from /var/spool/mail/user_name by message number. Retrieved messages will then be stored in ~user_name/mbox

- 40 - 11.0 NFS – Network File System

11.1 General Information

● Purpose: To share files over the network

● Daemons: nfsd network file system portmap portmap

● Server root: /etc/rc.d/init.d

● Port 2049

● Configuration file: (refer to section 11.6)

● localhost ip address: 127.0.0.1

● there are no device special files for ethernet boards (eth0)

● lo is the loopback interface

11.2 Setting up a Network

Required Information:

1. your ip address (use the 'ifconfig' command) 2. your hostname (use the 'hostname' command) 3. your domain (i.e. nmu.edu) 4. type of ethernet (NIC) card and a software driver 5. ip address of your name server 6. any gateways and the routes associated with them

- 41 - 11.3 Setting up an NFS Server

1. create a shareable folder on the server machine and put a file in this folder: $mkdir /share $cd /share $chmod 777 share set directory permissions $ps > yourname

2. Edit /etc/exports to include the shareable folder $pico /etc/exports /share ares.nmu.edu(async,rw) where ares is the remote host that is allowed to use this shareable folder -or- /share *.nmu.edu(async,rw) all hosts in the domain are allowed to use this shareable folder

3. Run exportfs $exportfs -a (no message means no errors)

4. Make sure links exist in /etc/rc.d/rcn.d, where n is the RUNLEVEL, for the following scripts: netfs, nfs and portmap

$cd /etc/rc.d/rc5.d $ln -s ../init.d/nfs S60nfs

5. Make sure all daemons are running $./S60nfs start

- 42 - 11.4 Setting up an NFS Client

1. make a directory for a mounting point $mkdir /tmp/share

2. mount the shareable disk space by hand (must be root) $mount server_host:/share /tmp/share $cd /tmp/share (this step is required to reset the mounting point) $ls -l (you should see the file created above)

3. to unmount the shareable space $umount /tmp/share

4. Edit /etc/fstab to make the change permanent (must be root). Refer to section 4.1 for an example of the fstab entry.

- 43 - 11.5 Commands

$dig ip_address provide a hostname $host ip_address provide a hostname $hostname display and set host name $ifconfig display ip address (inet addr) of local host $ifconfig eth0 up check status of interface; no message means ok

$netstat -r display kernel routing table $netstat -s display network statistics

$nslookup www.yahoo.com lists ip addresses for site $nslookup ip_address provide a hostname $ping hostname (or ip address of host) send messages to host. tests network connectivity.

$ping -f hostname flood messages to host (be careful with this option!)

$route -e display kernel routing table $route manipulates the kernel's IP routing tables. indicates which interface to use for a given ip_address $route add default gw ip_address add a gateway to the given ip_address

$tcpdump display traffic on the network $traceroute URL display route

- 44 - 11.6 Special Files

/etc/exports list of shared folders

/etc/hosts list of ip_addresses and hostnames (local DNS); most utilities go here first except nslookup and dig ip_address hostname1 hostname2 127.0.0.1 localhost 198.110.206.30 spiderman spiderman.nmu.edu

/etc/resolv.conf ip addresses for name servers

/etc/services list of network port numbers

/etc/sysconfig/network local network parameters

/etc/sysconfig/network-scripts/ifcfg-eth0 parameters for ethernet card, such as, "dhcp" protocol

/proc/net/* network process information

- 45 - 12.0 X11 – X Window Server

12.1 General Information

● Daemon: xfs, X font Server vncserver vnc Server XFree86 X Window Server

● Server root: /etc/X11

● Port 6000

● Configuration file: /etc/X11/XF86Config

This file contains the following sections: "Input Device" -- parameters for Keyboard and Mouse "Device" -- parameters for the Video card "Monitor" -- parameters for the Video display "Screen" – parameters for screen resolution

Screen resolution modes can be temporarily changed by using the Ctrl Alt + (or -) keys to cycle through all available modes.

12.2 vnc Remote Desktop

● vnc Server (the CPU with the graphics card)

On the LINUX system, run vncserver (non-root user):

$vncserver

Password: xxxxx Verify: xxxxx

New 'X' desktop is hostname:n

Use the following command to change the vnc password: $vncpasswd

Note: No startup link is needed for vnc. The vnc daemon does not need to run after bootup.

For server security, the user may logout after starting the vnc server.

- 46 - 12.2 vnc Remote Desktop (continued)

● vnc Client

On a Windows XP system, Run VNCviewer (start ► All Programs ► VNC ► Run VNCviewer)

Enter VNC server: (use hostname:n from above) Enter Session password: (use Password from above)

Now the client desktop will look just like the remote (server) desktop.

12.3 Commands

$xhost +hostname add hostname to list allowed to connect to X server. Any user from hostname can use the X server. $xhost -hostname delete hostname from list $xdpyinfo display information about X server

12.4 Exporting your Display

Server commands: $xhost +client add client hostname to connect list $echo $DISPLAY displays server current display number :h.d

Client commands: $export DISPLAY=server:h.d send client display to server $xlogo& ksirtet& run 2 programs on client; see display on server (ksirtet is a Linux flavor of the tetris game)

Server commands: $xhost -client delete client hostname from connect list when done

- 47 - 13.0 Samba

13.1 General Information

● Daemon: smbd, file and print sharing nmbd, nameserving and browsing support

● Server root: /etc/samba

● Configuration file: /etc/samba/smb.conf

Important Variables: server string = MySamba Server log file = /var/log/samba/%m.log %m = client name encrypt passwords = yes smb passwd file = /etc/samba/smbpasswd create mode = 0664 file permissions

● Samba users file: /etc/samba/smbusers

linux name = windows name for example, root = administrator

13.2 Commands

$smbadduser linuxid:windowsid add samba user; linuxid must be a current Linux user $smbpasswd linuxid add password for samba user

13.3 Setting up a Samba Connection

● On the LINUX computer:

1. make sure the Samba daemon is running 2. $smbadduser linuxid:windowsid enter samba password when prompted

- 48 - 13.3 Setting up a Samba Connection (continued)

● On the Windows computer:

1. right-click on My Computer 2. select Map Network Drive 3. select an unused drive, (i.e., M: ) 4. enter \\hostname\linuxid for Folder, and check Reconnect at Logon, 5. click Finish 6. In the connect pop-up dialog, enter User name: windowsid Password: samba password and then check Remember my password 7. click OK.

Now your Windows mapped drive (M: in this case) will map directly into the user's home directory on the LINUX computer.

- 49 - 14.0 Printing

14.1 General Information

● IPP – Internet Printing Protocol

● Daemon: cups – common unix printing system

● Server root: /etc/cups mime.convs filters (postscript -> dot matrix)

● Configuration file: /etc/cups/cupsd.conf DefaultLanguage en // affects banner page

14.2 Commands

$lpr -Pprintername filename print file $lp -Pprintername filename print file $lpq queue status $lpstat printer status $lprm remove print job $lpc queue status $nl number lines of output $pr format lines of output

- 50 - 14.3 Installation

14.3.1 System Settings – Printing

1. printer configuration, click New icon 2. Add a new Print Queue, click Forward ► 3. Enter name and description for your printer, Name: myPrinter Desc: then click Forward ► 4. Enter Queue type, Networked UNIX 5. Enter ip address and Queue name, Server Queue 198.110.193.149 lp then click Forward ► 6. Enter Printer Model manuf. HP model LaserJet 5M then click Forward ► 7. click Apply 8. test page, click NO

- 51 - 14.3 Installation

14.3.2 Web

1. start Web browser 2. use URL http://localhost:631/ 3. select Manage Printers 4. select Add Printer 5. enter userid and password 6. enter name: WebLP loc: desc: and then Continue 7. Security warning, Continue 8. enter Device: LPD/LPR, and then Continue 9. Security warning, Continue 10. enter Device URI: lpd://198.110.193.149/lp lpd://hostname or ip address/queue name and then Continue 11. enter Make: HP, and then Continue 12. enter Model: HP LasetJet, and then Continue 13. Confirmation message

- 52 - 15.0 Scripting

15.1 General Information

Shell scripting or programming is a way to store sets of commands into one file that can be run just like a single command. Shell scripts can be reused as often as necessary. Shell scripts save typing. Shell scripts are much like DOS batch files.

Shell scripts or programs can be created with any text editor, like pico, vi or emacs. To run a shell script, the script file must have executable permission (x). Also, the script must be stored in a directory on the shell search path or the path must be explicitly provided.

The following is a simple shell script which just runs a set of bash commands:

#!/bin/bash cd ~user/makeprog rm *.o make prog cp prog /usr/bin

The first line above, '#!/bin/bash' indicates which shell or program executes the script commands. Assume this shell is saved in the file, myshell.sh. Make the file executable by issuing the following command:

$chmod u+x myshell.sh (use a+x if everyone can use this shell)

The shell can be run as follows:

$bash myshell.sh from current directory -or- $./myshell.sh from current directory -or- $myshell.sh if myshell.sh stored in /usr/bin

- 53 - 15.2 Shell Programming in Bash

The Bash shell has a full-featured programming language including variables, control structures, functions and input/output methods (see Bash sample script below). Bash is used a lot since this shell is available on all UNIX/LINUX computers. Many important system scripts, such as the Startup scripts used by the init process, are written in Bash.

● Variables

Variables can be assigned numeric or string values and command strings.

$let a=4 assign numeric value $let b=3 $let c=a*b $echo $c 12

$let a=2*3 $let a=2**3 2*2*2 = 8

$a=4 assign string values $a=myname $a='dave smith'

$echo $a display value of variable a

$a=`ls -la` assign command string $echo $a run command stored in a

$export a make the variable an environment variable that can be used by all commands

- 54 - 15.2 Shell Programming in Bash (continued)

● Boolean Values

true = 0 false = !0 (not 0)

the program file, /bin/true, returns 0 when run and the program file, /bin/false, returns !0 when run

There are numeric and string comparison operators. For example,

$a > 3 is a string compare $a -gt 3 is a numeric compare

● Special Boolean Flags

-f file exists -d directory exists -e either file or directory exist -r readable file exists -w writeable file exists -x executable file exists -z string exists (length > 0)

if [ -f $file ]; then echo $file exists fi

- 55 - 15.2 Shell Programming in Bash (continued)

● Control Structures

□ while loop

while [ condition ]; do commands done

□ for loop

for var in {set} do commands done

□ if statement

if [ condition ] ; then Note: space after [ and commands before ] are required fi

for example,

if grep -q dpowers /etc/passwd; then echo dpowers is a valid user fi

□ if-else statement

if [ condition ] ; then commands else commands fi

- 56 - 15.2 Shell Programming in Bash (continued)

● Shell Arguments

$1 first shell argument $* all shell arguments

□ mail kill spam message $./killspam user_name

killspam #!/bin/bash echo Please do not spam me | mail $1

□ display all shell command arguments $./showargs arg1 arg2 arg3

showargs #!/bin/bash for a in $* do echo $a done

- 57 - 15.3 Sample Scripts

● Bash1 - with a while loop, input method and a variable (a)

#!/bin/bash ls | while read a do echo $a done

This script will list all the files in a directory, one file per line.

● Bash2 - with a for loop and a variable (a)

#!/bin/bash for a in 2 3 5 7 11 do echo $a is a prime number done

This script will list all the primes in the set.

● Perl - a very simple Perl Script

#!/bin/perl print "Content-type: text/html\n\n"; print "Hello World.\n";

This example could be used with a web browser because of the first print line.

Perl is much more powerful than Bash for scripting and could be used for more complex applications.

- 58 - 16.0 Installing Software Packages

16.1 Installing Software Packages

● Installing software packages on Redhat LINUX can be done in one of two (2) ways:

1. Finding and installing an RPM file. RPM stands for Redhat Package Manager. RPM files can be found at www.rpmfind.net as well as other Web sites.

For example, an rpm file (get i386 version for Intel xx86 PC) for the wumpus game can be found at the web site, www.ibiblio.org/pub/Linux/games/strategy/!INDEX.short.html and downloaded to a local directory.

$rpm –i wumpus-1.3-1.i386.rpm install program $rpm –e wumpus-1.3-1 uninstall program

Some problems that occur when installing rpm files are failed dependencies and file conflicts. These problems can be ignored by using the --nodeps and --force options respectively.

2. Finding the source code and making (compiling) a new executable. Source files can be found at www.sourceforge.net as well as other Web sites.

For example, the source files for the wumpus game can be found at the web site, www.ibiblio.org/pub/Linux/games/strategy/!INDEX.short.html and downloaded to a local directory.

$tar xfz wumpus-1.3.tar.gz uncompress the archive file; this creates a directory that contains all the source files $cd wumpus-1.3 change to source directory $cat README read README file looking for any special installation instructions $make compile sources into an executable $make install copies executable and man pages to the appropriate directories $make uninstall remove executable and man pages

A common problem that occurs when making software from source code is missing definitions or files during compilation.

- 59 - 16.0 Installing Software Packages (continued)

16.2 Adding/Removing Standard Redhat Applications

Select System Settings ► Add/Remove Applications from the Redhat Desktop

Applications and Servers, such as, Apache Web Server, sendmail mail server, ftp and others, can be installed or uninstalled from your system.

16.3 Resources

Redhat V9.0 updates: list of enhancements and bug fixes https://rhn.redhat.com/errata/rh9-errata.html

Redhat V9.0 Bug fix #247 https://rhn.redhat.com/errata/RHBA-2003-247.html

RPM "how to" guide http://tldp.org/HOWTO/RPM-HOWTO/index.html

- 60 - 17.0 Linux Resources

17.1 MAN pages

$man bash (or any command) $man –k command (list all pages for command) $man 3 printf (show a specific page) $info bash (or any command) $help command (any shell built-in command) $help (list all built-in commands) $command --help (for any command)

17.2 Web pages

www.google.com search engine; search for LINUX info kt.zork.net LINUX kernel traffic site www.tldp.org LINUX Documentation Project counter.li.org stats and graphs on LINUX worldwide use www.linux.org a resource site for LINUX www.linuxjournal.com LINUX journal site www.linuxmall.com LINUX products www.freshmeat.net a resource site for LINUX www.redhat.com Redhat LINUX distribution site groups.google.com google groups; usenet site

- 61 - 18.0 Rebuild Linux Kernel

Reasons to rebuild the Linux Kernel: 1. fix bugs 2. add enhancements (including new device drivers) 3. customize the kernel code

Steps to rebuild the LINUX kernel:

1. download new kernel source from ftp site

even versions (2.0, 2.2, etc.) are production versions and odd versions (2.1, 2.3, etc.) are development versions.

$uname -a displays current kernel version

$ftp ftp.kernel.org Name: anonymous Password: (anything) ftp> cd /pub/linux/kernel/v2.6 ftp> ls *tar.gz (to list all source files) ftp> binary (set binary mode) ftp> get linux-2.6.0.tar.gz (save in /usr/src directory) ftp> bye

2. untar and uncompress file. this will create a directory, linux-2.6.0, that will contain all the source files

$tar xvzf linux-2.6.0.tar.gz

3. change to source directory

$cd linux-2.6.0

4. make config file

$make config text interface; many questions to answer - or- $make menuconfig gui interface for linux kernel options

5. rpm module-init-tools (only needed when major changes occur; i.e., if going from V2.4 to V2.6)

$rpm -i module-init-tools-version.i586.rpm

- 62 - 18.0 Rebuild Linux Kernel (continued)

6. edit Makefile

change gcc to gcc296 and g++ to g++296

7. $make bzImage build linux kernel this step takes a while (1 hour +) -or-

$make $make install

8. $make modules_install

9. find kernel file and copy to /boot

$cp arch/i386/boot/bzImage /boot

10. edit grub.conf file to include the new kernel. add an entry identical to current image but with new kernel file

/boot/grub/grub.conf boot loader config file (a sample with 2 OS images) title Dave root(hd0,0) kernel /boot/vmlinuz-2.4.20-8 ro root=/dev/hda1 initrd /boot/initrd-2.4.20-8.img

title NewKernel root(hd0,0) kernel /boot/bzImage ro root=/dev/hda1 initrd /boot/initrd-newversion.img

title Fred root(hd0,1) kernel /boot/vmlinuz-2.4.20-8 ro root=/dev/hda2 initrd /boot/initrd-2.4.20-8.img

Also, the 'mkinitrd' command can be used to create initial ramdisk images.

11. reboot and select new grub entry to use new kernel

- 63 - APPENDIX

Appendix A - Utility Commands

$cal display monthly calendar $date display date and time $time command displays time to run command $uptime system uptime (since last reboot)

Appendix B - Secure Shell (ssh) and Putty

● From Windows, use putty.exe to obtain a secure shell (ssh) command window into a remote Linux host. You will need the remote host name or ip address. You will also need a valid user name and password on the remote host.

● From another Linux terminal window, issue the following command:

$ssh user_name@remote_host

You will be prompted for a valid password.

- 64 - APPENDIX

Appendix C - Summary of Network Services

Startup Service Link Daemon Purpose Server/Client OS File Transfer Y vsftpd file transfer between Linux/ any Protocol (ftp) computers

Apache Web Y httpd provides Web pages Linux/ any Server to client programs

Sendmail e-mail Y sendmail e-mail message transfer Linux/ any Server between users

Network File Y nfsd file sharing with other Linux / Linux System hosts

vnc Server N vncserver provides remote Linux/ any desktop to client

xhost command N ----- export client program Linux/ Linux GUI to the server

Samba Server Y smbd file and printer sharing Linux/ any with other users

Secure Shell Y sshd provides remote Linux/ any console window to client

- 65 - Glossary

daemon system process running in the background. Normally server programs waiting to serve client requests. DHCP Dynamic Host Communications Protocol DNS Domain Name Server gateway an ip address that network packets are routed to hostname internet name for your computer ip address internet address for your computer IRQ the interrupt level a device uses to get the CPU's attention job background or suspended process login shell the shell program that runs when you log on mac address media access address; address of your network interface card (NIC) meta data data about data NIC network interface card path the directories that a shell searches o find a command or program PID process id port a data channel between a device and the CPU RPM Redhat Package Manager script a program or set of commands, usually written as a shell script or written in Perl shell command interpreter virtual hosting multiple DNS (domain names) names that have the same ip address; i.e., virtual hosts

- 66 -

Recommended publications