Datasheet

Using the Root Account
To avoid occasional accidental system damage the removal of core system files, accidentally wiping
out system utilities with your own, and so on it’s usual to do your everyday work as a regular user on
your machine. A regular user has full access to his or her home directory (under /home) and can easily
build and test out most regular application software. This is sufficient for most development tasks, but
there are times when you will need to gain access to the administrative (root) account in order to modify
global system settings, install test software, and generally to get the job done.
Rather than using your system entirely as the root user, or logging out and logging in as root whenever
you need access to the root account, it’s recommended that you use the sudo utility. Sudo enables you to
run a single command as the root user, without running the risk of having to be logged in with such
powers all of the time. It’s amazing how easily you can accidentally trash a system with a single mis-
taken command as the root user. Hence, most developers generally use their own accounts.
To use sudo, you’ll need to ensure that your regular user account is listed in
/etc/sudoers. For exam-
ple, the user account “jcm” can be granted sudo permission with the following entry:
jcm ALL=(ALL) ALL
This grants jcm permission to run any command as the root user (on any machine – there’s only the local
machine to worry about in most cases, but if you’re on a network, check with your IS/IT folks). To actu-
ally run a command with root permissions, you can use the
sudo command:
$ sudo whoami
root
You will be asked for a password, if you have not entered one recently.
The first time you use it, sudo warns you about the dangerous things you can do as a root user and then
asks for a password, which may not be the same as your login password. On some distributions, sudo is
configured to ask for the root account password by default, others will use your own login password in
order to gain access to the sudo tool. You’ll want to check your distribution’s documentation or use the
UNIX
man command to find out more information about the local installation.
If you’re working within a corporate environment, don’t forget to notify your IT or IS department that
you will require administrative access to your development machine. It’ll save a lot of hassle later on,
unless they specifically want to support you every time you need to use the root account.
Development Releases
Linux distributions usually have a development version that closely tracks ongoing development of the
distribution itself. Such versions are updated far more often that their stable release counterparts. Stable
distribution releases usually vary between 6 months and 18 months apart, while a development version
might change on even a daily basis. The big three distributionsthose from Red Hat, SuSE, and
Ubuntu all have unstable development releases available on a daily basis. You won’t normally need to
look at these, but it helps to know they’re out there, so here’s a quick overview of the alternatives.
Development releases of modern distributions are explained here for your interest and education. They
may aid in some of your development decisions, but you should not directly build or develop production
software on them. Changes occur frequently, making it extremely difficult to achieve reproducible
results. Complete system breakage is also not that uncommon.
13
Chapter 1: Working with Linux
04_776130 ch01.qxp 2/2/07 10:11 PM Page 13