root represents possibly the most important thing to understand about Linux that differs from Windows. You may have heard that Linux is more stable and secure than other operating systems, particularly Windows. The main reason that Windows is not stable or secure is because anyone using Windows can do just about anything. For example, on Tara’s computer, she just turns it on, waits for it to boot up, and then goes to work. She has complete power over the system. Whether Tara is a computer hacker or a know-nothing, she can do whatever she wants to the computer. This includes deleting things, changing configurations, etc. So can anyone else who turns on her computer. Or anyone that browses to her computer over the network. This is not to say that Windows does not have controls over this sort of thing, but those controls have always been pretty weak, especially for home users. It has become better and better about this. Vista does pretty well in terms of enforcing security. But Windows XP is questionably secure, while Windows 98 is just completely insecure.
You may say “I have a login on my computer.” That’s very possible. However, in most cases this is for user convenience. If Mike logs in as Mike, he sees his Desktop and files, and Tara, when she logs in as Tara, sees hers. But they can still find each others files on the computer. The login is for the users’ convenience and secondly for their security. Either one of them can do anything they like to the computer. They can erase programs, configurations, or even each others’ files! Newer versions of Windows have made it harder to find their files, but the files are there nonetheless. Some login screens to Windows will even allow other people in. They can just enter whatever they want and Windows will decide that this is a new user and create their desktop and personal folders and then let them in. From there, they are free to do whatever they like.
Linux has a solution to this. It is called root. Linux, unlike Windows, is a true multi-user operating system. So you will always have to login. Recently, I have noticed that there are ways to set Linux up to always login a specified user automatically. This may seem strange since I just said that going straight into Windows was a security risk. But in Linux, if someone else gains access to your computer, they really can’t do much harm to your computer. They could access your personal files, but couldn’t do much to the computer and its programs. Consequently, you too have limited powers when you log into Linux in what you can do to the computer.
At this point, you’re probably wondering how you’d add or delete programs, change settings, etc. Well you can’t . But root can. Root is the username of the system administrator. So at work, your IT department might not give you this and so you’d have limited power over your computer. At home, though, when you install Linux, you will setup the root password. So at home, Tara can log in as tara and have limited power, or she can log in as root and have total power. DO NOT LOSE THAT PASSWORD. As far as I know, if you lose it, it’s gone.
That said, you should never log in as root in your desktop. If you need to do something as root, log in as normal and then open a terminal and log in as root in the terminal window. This is less risky.
Some versions of Linux, such as Ubuntu, in a way hide root in favor of something called sudo. Rather than logging into the root account, you just preface the command with sudo and the command is run as root. This only works for special Administrator accounts on the computer.
Every file in Linux belongs to somebody and if you are not that somebody, you can sometimes look at a file, but you can almost never change it. However, root can do anything to any file.
If you’re going to be using Linux at home, the benefits to this are:
- when you log in and do things, you won’t accidentally damage the system settings and required files.
- your children can’t either and there’s no reason you should ever have to share the root password with them or anyone else.
- but you can use the root password to get in and do things you need to.
If you’re at work:
- if you aren’t given the root password, odds are that you’ll never hurt you machine. The IT department appreciates this as well.
- if you do somehow manage to do something to the computer, there’s nothing you can do and the IT department will take over.
- if you share a computer, other users don’t even have the ability to see that you have files, in addition to not letting them accidentally do something to them.
If you’re at school:
- students can be given user accounts, but since they don’t have the root password, they won’t be able to damage the system (other than physically harming it) or change teacher data, etc.
- students’ work is private and won’t be copied electronically.
So as an example, Tara decides to set up a Linux computer at home. During the install, she sets the root password to denk325. She also adds two user accounts, tara and tommy for her son. When it’s all set up and ready to go, Tara gives Tommy his username and password. Tommy can now log in. He can customize his wallpaper or whatever he wants to do. Tara can log in later as tara and customize her settings, too. All their files are in their own directories. One day, Tommy is poking around and sees a folder named “boot” and decides it’s pointless. Well it actually contains the information Linux must have to start. He presses delete. Nothing happens. He doesn’t have root access! Windows didn’t stop him before when he deleted all of Tara’s e-mails, but Linux won’t let him leave his personal area.
Later, Tara reads that there’s an update for a program she uses in Linux. She clicks the button to start the update. Linux prompts her for the password. She types denk327 and then presses enter. If it’s the right password, the update will proceed.
You’ll notice that in the terminal, you always will know who you are logged in as. It says [email protected] and the directory you’re in at every prompt. So while she is tara, it will say [email protected], but when she logs in as root, it says [email protected].
Remember the power of root. It is your friend if you use it carefully and sparingly.