Friday, April 3, 2009

Root

In Linux, the "root" account is the administrative account. In most of my systems, I'll have a "user" account that I use for most things, and a "root" account that I almost never log into. This is a little different than in Windows, where most users go with only one account, and do adminstrative tasks from that same account.

When I need to do adminstrative tasks in Linux, I stay in my "user" account and gain "root" access in one of a number of ways. I can go to the command line and type su and my "root" password; or I can open a file manager like Konqueror and gain "root" access through that.

Ubuntu-type distros do things a bit differently. There, you'll have no "root" account, but you can gain adminstrative access by using the sudo command, for example. The password is the same as the one for your "user" account.

This isn't a comprehensive explanation of the situation, but you get the general idea.

One thing I found confusing at first about Linux is that besides the "root" account, there's also the root directory -- denoted by "/" -- and there's root's home directory, denoted by "/root." (One thing to keep in mind is that what Linux users call a "directory" is pretty much the same thing as what Windows users call a "folder.")

The root directory is the top of the filesytem in Linux. All other directories live under the "/" directory. Here's a look at my "/" directory in Debian Lenny:



So in Linux, the directory structure looks something like this:

/
/bin
/boot
/cdrom
/dev
/etc
/home
...

And so on. For more info on the Linux filesystem (directory structure), try doing a few Google searches. Here are few pages that can give you an overview of the way things are set up (but, there's lots more out there!):

http://www.freeos.com/articles/3102/
http://www.faqs.org/docs/linux_intro/sect_03_01.html
http://www.er.uqam.ca/nobel/r10735/unixcomm.html
http://www.pathname.com/fhs/pub/fhs-2.3.html

The "/root" directory contains the settings and files for the root account, in the same way that the "/home/[username]" directory contains the settings and files for "username's" account. In my case, I don't log into the root account or use it for much of anything, so my "/root" directory in Debian Lenny is mostly empty, except for some "hidden" files and directories (everything with a "." in front of the name is a "hidden" file or directory and will not appear in a Konqueror window unless you use the "Show Hidden Files" option; at the command line, you can use the -a trigger with the ls command to show the "hidden" files in a directory) that I rarely even look at:



Many users find it irritating to always have to enter the root password to do adminstrative tasks; but this arrangement is one of the reasons why Linux is so secure. A hacker can't do much to your system without having the root password; and if you're never logged into the root account, you're much less likely to do something dumb and mess up your system.

I found the Linux way to be quite confusing at first, but now it seems much more sensible than having things like C: and G: drives in Windows, and I find myself much more at ease navigating through Linux directories than I ever was working with Windows folders.

No comments: