132 Part II . Running the Show The (Web server on xp)
132 Part II . Running the Show The home directory for the root user is typically /root. The home directory and other information associated with the root user account are located in the /etc/passwd file. Here s what the root entry looks like in the /etc/passwd file: root:x:0:0:root:/root:/bin/bash This shows that for the user named root the user ID is set to 0 (root user), the group ID is set to 0 (root group), the home directory is /root, and the shell for that user is /bin/bash. (We re using a shadow password file to store encrypted password data, so the password field here contains an x.) You can change the home directory or the shell used by editing the values in this file. A better way to change these values, however, is to use the useradd command (described later in this chapter). Becoming Root from the Shell (su Command) Although you can become the superuser by logging in as root, sometimes that is not convenient. For example, you may be logged in to a regular user account and just want to make a quick administrative change to your system without having to log out and log back in. Or, you may need to log in over the network to make a change to a Linux system but find that the system doesn t allow root users in from over the network (a common practice in the days before secure shells were available). The solution is to use the su command. From any Terminal window or shell, you can simply type the following: $ su Password: ****** # When you are prompted, type in the root user s password. The prompt for the regular user ($) changes to the superuser prompt (#). At this point, you have full permission to run any command and use any file on the system. However, one thing that the su command doesn t do when used this way is read in the root user s environment. As a result, you may type a command that you know is available and get the message Command Not Found. To fix this problem, use the su command with the dash (-) option instead, like this: $ su - Password: ****** # You still need to type the password, but after that, everything that normally happens at login for the root user happens after the su command is completed. Your current directory will be root s home directory (probably /root), and things such
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.