Being Sysadmin, the Root User in SUSE Linux 9.3

System administration, or sysadmin for short, refers to whatever has to be done to keep a computer system up and running; the system administrator (also called the sysadmin) is whoever is in charge of taking care of these tasks. If you're running Linux at home or in a small office, you're most likely the system administrator for your systems. Or maybe you're the system administrator for a whole LAN full of Linux systems.

Becoming root, when you must

You have to log in as root to perform the system administration tasks. The root user is the superuser and the only account with all the privileges needed to do anything in the system.

Common wisdom says you should not normally log in as root. When you're root, all it takes is one misstep, and you can easily delete all the files — especially when you're typing commands. Take, for example, the command rm *.html that you may type to delete all files that have the .html extension. What if you accidentally press the spacebar after the asterisk (*)? The shell takes the command to be rm * .html and — because * matches any filename — deletes everything in the current directory. Seems implausible until it happens to you!

If you're logged in as a normal user, how do you do any system administration chores? Well, you become root for the time being. If you're working at a terminal window or text-mode console, type

su -

Then enter the root password in response to the prompt. From this point on, you're root. Do whatever you have to do. To return to your usual self, type

exit

That's it! It's that easy.

Resetting a forgotten root password

To perform system administration tasks, you have to know the root password. What happens if you forget the root password? Not to worry: Just reboot the PC and you can reset the root password by following these steps:

1. Reboot the PC (select Reboot as you log out of the GUI screen) or power up as usual.

Soon you see the graphical boot screen that shows the names of the operating systems you can boot. The text cursor rests on a line labeled Boot Options.

2. If you have more than one operating system installed, use the arrow key to select SUSE Linux as your operating system.

3. Type the following and then press Enter:

single init=/bin/sh

Linux starts up as usual but runs in a single-user mode that does not require you to log in. After Linux starts, you see the following command line prompt that ends with a hash mark (#), similar to the following:

sh-3.00#

4. Type the following command, and then press Enter:

mount / -n -o remount,rw

This makes the root file system — the forward slash (/) in the mount command — writeable so that you can change the password (which is stored in a file in the root file system).

5. Type the passwd command to change the root password as follows:

sh-3.00# passwd

Changing password for user root.

New password:

6. Type the new root password that you want to use (it doesn't appear on-screen), and then press Enter.

The passwd command asks for the password again, like this:

Re-enter new password:

7. Type the password again, and press Enter.

If you enter the same password both times, the passwd command changes the root password.

8. Type the following command and press Enter.

mount / -n -o remount,ro

This remounts the root file system in a read-only mode.

9. Now type /sbin/reboot to reboot the PC.

After SUSE Linux restarts, you can again become root by typing su - and entering the new password. When GUI utilities such as YaST prompt for the root password, enter the new root password.

Make sure that your SUSE Linux PC is physically secure. As these steps show, anyone who can physically access your SUSE Linux PC can simply reboot, set a new root password, and do whatever they want with the system.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com