Wednesday, October 28, 2009

Congratulations! You're a System Administrator!













Congratulations! You’re a System Administrator!

Using Linux is no different from using any other UNIX, as long as it’s on someone else’s computer, and he or she has set you up with an account. When your computer is running Linux, however, and you are responsible for maintaining it, things become much more complicated. Although we have no way to teach all the complexities of Linux system administration in a book like this one, we can describe a few key points to get you started.



Linux For Dummies, 5th Edition, by Dee-Ann LeBlanc (published by Wiley Publishing) is a great introduction to Linux and Linux administration. Running Linux, by Welsh and Kaufman (published by O’Reilly & Associates), has most of the information you need to really administer a Linux system. Also, the World Wide Web is awash in sites devoted to Linux. A good place to start is the popular Linux site at www.linux.org/. (See Chapter 18 for more information about the World Wide Web if you’re uncertain what it means.) Chapter 26 lists a number of other places to go Linux hunting on the World Wide Web.




The root of all UNIX


UNIX is a multi-user world, and that includes Linux: Lots of people can use the computer at the same time, by connecting from remote locations. The first thing you need to know about administering a Linux system is the difference between the user called root and every other user. Root (also grandly called the superuser) is the system administrator. This account has all the privileges to change things on the system. If you want to add users, install some software, or even turn off the computer, you must be logged in as root. If you’re logged in as someone other than root and you try to do anything related to system administration, your computer responds with a barrage of “permission denied” messages. It’s nothing personal. It’s just the computer’s way of telling you that in a multi-user environment, it doesn’t want just anyone messing around with it — only the one person it trusts, which is root.


“Fine,” you say. “I’ll just log in as root all the time and not have to worry about running into those pesky permission problems.” Bad idea! Using the root account to do non-system-administration tasks is dangerous because sometime — eventually, when you least expect it — you type a command you really didn’t want to — oh, say, deleting all the files on the hard drive (it happens more frequently than you may think). If you’re logged in as someone other than root, the computer replies with a simple “permission denied.” If you’re root, though, the damage is done, and Linux (or any other version of UNIX) does not have an undelete command! Remember that permissions are your friends!





Adding a user


Assuming that you’re convinced about not logging in as root unless you really must, you have to add a user account for yourself (or for others) to use for everyday tasks. Suppose that you want to create the username bobbyjoe for yourself. To add this user, log in as root (because adding users is one of those special, privileged tasks that only root can perform) and at the shell prompt type the command adduser bobbyjoe. The computer creates the new user and then, if you’re lucky, reminds you to set the password for the new user. Whether or not the computer reminds you, you have to add the password by typing passwd bobbyjoe. Then enter the password when the computer asks for it. It asks you to enter the password twice, just to make sure that you typed it correctly.








With some versions of Linux, your computer gives you remedial password advice if it thinks that you need it. If you create a user named noah and then try to add the password ark, your computer may say BAD PASSWORD: It’s WAY too short. If you try to fake the computer out by adding the password arkarkark, it may say BAD PASSWORD: it does not contain enough DIFFERENT characters. If you’re not sure what constitutes a good password, go back and read the section in Chapter 1 about password smarts. As a system administrator, you’re responsible for the security of the system, so don’t say that you haven’t been warned.





How do I turn this thing off?


UNIX and Linux are very sensitive to impolite treatment on the part of the operator. If you just log out and turn off the machine with the power switch, it reminds you of this rude treatment with a flood of error messages when you next restart the computer. To turn the machine off, you first must execute the shutdown command. While logged in as root, enter the command shutdown now to turn the machine off gracefully. If other users are logged in and you want to give them some warning, you can type the number of minutes until shutdown: shutdown +10, for example, waits ten minutes before shutting down and warns any users who are logged in. To reboot the computer, shutdown -r now (-r for reboot) shuts down the machine and then restarts it. Some Linux systems also let the "three-finger salute" (Ctrl+Alt+Del, familiar to DOS and Windows users) serve as a shortcut for shutdown -r now.












No comments: