From aeda912e7c8bce9116b6a1d557485d080cc70b61 Mon Sep 17 00:00:00 2001 From: John Fieber Date: Fri, 15 Aug 1997 17:11:49 +0000 Subject: [PATCH] New Improved! Submitted by: Annelise Anderson --- data/tutorials/newuser/newuser.docb | 202 ++++++++++++++++++++-------- 1 file changed, 149 insertions(+), 53 deletions(-) diff --git a/data/tutorials/newuser/newuser.docb b/data/tutorials/newuser/newuser.docb index 9e73b8a35e..9adefd509b 100644 --- a/data/tutorials/newuser/newuser.docb +++ b/data/tutorials/newuser/newuser.docb @@ -1,4 +1,4 @@ - + @@ -13,12 +13,12 @@ Annelise Anderson -
andrsn@hoover.stanford.edu
+
andrsn@andrsn.stanford.edu
-June 30, 1996 +August 15, 1997 Congratulations on installing FreeBSD! This introduction is for people new to both FreeBSD @@ -39,7 +39,9 @@ class=prompt>login:) as a user you created during installation or as root. (Your FreeBSD installation will already have an account for root; root can go anywhere and do anything, including deleting essential files, so be -careful!) +careful!) The symbols % and # in the following stand for the prompt +(yours may be different), with % indicating an ordinary user and +# indicating root. To log out (and get a new login: prompt) type @@ -81,8 +83,13 @@ are thus logged in as root, you should probably create a user now with # adduser -Don't use the option; the defaults are what -you want. Suppose you create a user jack with +The first time you use adduser, it might ask for some defaults to save. You +might want to make the default shell csh instead of sh, if it suggests +sh as the default. Otherwise just press enter to accept each default. +These defaults are saved in /etc/adduser.conf, +an editable file. + +Suppose you create a user jack with full name Jack Benimble. Give jack a password if security (even kids around who might pound on the keyboard) is an issue. When it asks you if you want to invite jack into other @@ -92,8 +99,7 @@ groups, type wheel This will make it possible to log in as jack and use the su command to become root. Then you won't -get scolded any more for logging in as root, and as root you'll have -the same environment as jack (this is good). +get scolded any more for logging in as root. You can quit adduser any time by typing CtrlC, and at @@ -112,7 +118,11 @@ power—and risk—of root. to su to root, you can log in as root and edit the file /etc/group, adding jack to the first line (the group wheel). But first you need to practice -vi, the text editor. +vi, the text editor--or use the simpler text +editor, ee, installed on recent version of +FreeBSD. + +To delete a user, use the rmuser command. @@ -171,8 +181,9 @@ date, permissions. ls -Lists hidden (unless you're root) dot -files with the others. +Lists hidden dot +files with the others. If you're root, thedot files +show up without the switch. @@ -284,7 +295,8 @@ is found. Tells you what the command text -does and its man page. +does and its man page. Typing whatis * will tell +you about all the binaries in the current directory. @@ -358,33 +370,41 @@ Administration (O'Reilly & Associates, 1993, ISBN To configure your system, you need to edit text files. Most of them will be in the /etc directory; and you'll -need to su to root to be able to change them. The -text editor is vi. Before you edit a file, you -should probably back it up. Suppose you want to edit -/etc/sysconfig. You could just use cd +need to su to root to be able to change them. You +can use the easy ee, but in the long run the +text editor vi is worth learning. There's an +excellent tutorial on vi in +/usr/src/contrib/nvi/docs/tutorial if you have +that installed; otherwise you can get it by ftp to +ftp.cdrom.com in the directory +FreeBSD/FreeBSD-current/src/contrib/nvi/docs/tutorial. + +Before you edit a +file, you should probably back it up. Suppose you want to edit +/etc/rc.conf. You could just use cd /etc to get to the /etc directory and do: -# cp sysconfig sysconfig.orig +# cp rc.conf rc.conf.orig -This would copy sysconfig to -sysconfig.orig, and you could later copy -sysconfig.orig to sysconfig to recover the original. But even +This would copy rc.conf to +rc.conf.orig, and you could later copy +rc.conf.orig to rc.conf to recover the original. But even better would be moving (renaming) and then copying back: -# mv sysconfig sysconfig.orig -# cp sysconfig.orig sysconfig +# mv rc.conf rc.conf.orig +# cp rc.conf.orig rc.conf because the mv command preserves the original date and owner of the file. You can now edit -sysconfig. If you want the original back, you'd -then mv sysconfig syconfig.myedit +rc.conf. If you want the original back, you'd +then mv rc.conf rc.conf.myedit (assuming you want to preserve your edited version) and then -# mv sysconfig.orig sysconfig +# mv rc.conf.orig rc.conf to put things back the way they were. @@ -532,9 +552,10 @@ print it from DOS. Suppose you want to read carefully about changing permissions on files (pretty important). You can use the command man chmod to read about it. The command -# man chmod > chmod.txt +# man chmod | col -b > chmod.txt -will send the man page to the chmod.txt file +will remove formatting codes and send the man page to +the chmod.txt file instead of showing it on your screen. Now put a dos-formatted diskette in your floppy drive a, su to root, and type @@ -574,7 +595,7 @@ out with # /sbin/umount /mnt and reboot to go to DOS. Copy these files to a DOS directory, call -them up with DOS EDIT, Windows Notepad, or a word processor, make a +them up with DOS EDIT, Windows Notepad or Wordpad, or a word processor, make a minor change so the file has to be saved, and print as you normally would from DOS or Windows. Hope it works! man pages come out best if printed with the dos print command. (Copying files from @@ -588,9 +609,9 @@ a matching spool directory in lpt0 (what dos calls LPT1), you may only need to go to /var/spool/output and (as root) create the directory lpd by typing: - -# mkdir lpd - + +mkdir lpd, if it doesn't already +exist. Then the printer should respond if it's turned on when the system is booted, and lp or lpr should send a file to the printer. Whether or not the file actually prints depends on configuring it, which is @@ -726,11 +747,13 @@ This should result in a /usr/local/kermit subdirectory that has all the files that the kermit subdirectory on the CDROM has. -Next, check /cdrom/ports/distfiles for a +Next, create the directory /usr/ports/distfiles +if it doesn't already exist using mkdir. Now check +check /cdrom/ports/distfiles for a file with a name that indicates it's the port you want. Copy that -file to /usr/ports/distfiles. (Create -/usr/ports/distfiles if it doesn't exist using -mkdir.) In the case of kermit, there is no +file to /usr/ports/distfiles; in recent versions +you can skip this step, as FreeBSD will do it for you. +In the case of kermit, there is no distfile. Then cd to the subdirectory of @@ -742,8 +765,8 @@ distfile. During this process the port will ftp to get any compressed -files it needs that it didn't find in -/usr/ports/distfiles. If you don't have your +files it needs that it didn't find on the cdrom or in +/usr/ports/distfiles. If you don't have your network running yet and there was no file for the port in /cdrom/ports/distfiles, you will have to get the distfile using another machine and copy it to @@ -778,8 +801,8 @@ work; no space after the slash.) You might want to get the most recent version of Netscape from their ftp site. (Netscape -requires the X Window System.) The version you want is the -unknown bsd version. Just use gunzip +requires the X Window System.) There's now a FreeBSD version, so look +around carefully. Just use gunzip filename and tar xvf filename on it, move the binary to /usr/local/bin or some other place binaries are @@ -804,32 +827,105 @@ is /usr/local/lib/netscape/netscape.bin. + + +Your Working Environment + +Your shell is the most important part of your working environment. +In DOS, the usual shell is command.com. The shell is what interprets +the commands you type on the command line, and thus communicates with +the rest of the operating system. You can also write shell +scripts, which are like DOS batch files: a series of commands to be +run without your intervention. + +Two shells come installed with FreeBSD: csh and sh. csh is good for +command-line work, but scripts should be written with sh (or bash). You can +find out what shell you have by typing echo $SHELL. + +The csh shell is okay, but tcsh does everything csh does and more. It +It allows you to recall commands with the arrow keys and edit them. +It has tab-key completion +of filenames (csh uses the escape key), and it lets you switch to the +directory you were last in with cd -. It's also much +easier to alter your prompt with tcsh. It makes life a lot easier. + +Here are the three steps for installing a new shell: + + 1. Install the shell as a port or a package, just as you +would any other port or package. Use rehash and +which tcsh (assuming you're installing tcsh) to +make sure it got installed. + + 2. As root, edit /etc/shells, adding +a line in the file for the new shell, in this case /usr/local/bin/tcsh, +and save the file. (Some ports may do this for you.) + + 3. Use the chsh command to change your shell to +tcsh permanently, or type tcsh at the prompt to +change your shell without logging in again. + +Note: It can be dangerous to change root's shell +to something other than sh or csh on early versions of FreeBSD and many +other versions of Unix; you may not have a working shell when the system +puts you into single user mode. The solution is to use su -m +to become root, which will give you the tcsh as root, because the shell is part +of the environment. You can make this permanent by adding it to your +.tcshrc file as an alias with alias su su -m. + +When tcsh starts up, it will read the +/etc/csh.cshrc and /etc/csh.login +files, as does csh. It will also read the +.login file in your home directory and the +.cshrc +file as well, unless you provide a .tcshrc +file. This you can do by simply copying .cshrc +to .tcshrc. + +Now that you've installed tcsh, you can adjust your prompt. You can +find the details in the manual page for tcsh, but here is a line to +put in your .tcshrc that will tell you how many +commands you have typed, what time it is, and what directory you are in. +It also produces a > if you're an ordinary user and +a # if you're root, but tsch will do that in any +case: + + set prompt = "%h %t %~ %# " + +This should go in the same place as the existing set prompt line +if there is one, or under "if($?prompt) then" if not. +Comment out the old line; you can always switch back to it if you prefer +it. Don't forget the spaces and quotes. You can get the .tcshrc reread by typing source .tcshrc. + +You can get a listing of other environmental variables that +have been set by typing env at the prompt. The +result will show you your default editor, pager, and terminal type, +among possibly many others. A useful command if you log in from a +remote location and can't run a program because the terminal isn't +capable is +setenv TERM vt100. + + + Other As root, you can dismount the CDROM with /sbin/umount /cdrom, take it out of the drive, insert another one, and mount it with /sbin/mount_cd9660 /dev/cd0a /cdrom assuming -cd0a is the device name for your CDROM drive. +cd0a is the device name for your CDROM drive. The +most recent versions of FreeBSD let you mount the cdrom with just +/sbin/mount /cdrom. Using the live file system—the second of FreeBSD's CDROM -disks—is useful if you've got limited space. You might try -using emacs or playing games from the cdrom. This +disks—is useful if you've got limited space. What is on the +live file system varies from release to release. You might try +playing games from the cdrom. This involves using lndir, which gets installed with the X Window System, to tell the program(s) where to find the necessary files, because they're in the /cdrom file system instead of in /usr and its subdirectories, which is where they're expected to be. Read man lndir. -You can delete a user (say, jack) by using the command -vipw to bring up the master.passwd -file (do not use vi directly on master.passwd); delete -the line for jack and save the file. Then edit -/etc/group, eliminating jack wherever it -appears. Finally, go to /usr/home and use -rm -R jack (to get rid of user jack's home -directory files). - @@ -841,7 +937,7 @@ if it was helpful. My thanks to Eugene W. Stark, professor of computer science at SUNY-Stony Brook, and John Fieber for helpful comments. -Annelise Anderson, andrsn@hoover.stanford.edu +Annelise Anderson, andrsn@andrsn.stanford.edu