Save file Ctrl+X, Ctrl+S
Search backward Ctrl+R
Search forward Ctrl+S
Start tutorial Ctrl+H, T
Undo Ctrl+X, U
TIP

One of the best reasons to learn how to use emacs is that you can use nearly all the same keystrokes to edit commands on the bash shell command line. Another reason is that like vi, emacs is universally available on nearly every UNIX and Linux system, including Apple's Mac OS X.

Working As Root

The root, or super-user account, is a special account and user on UNIX and Linux systems. Super-user permissions are required in part because of the restrictive file permissions assigned to important system configuration files. You must have root permission to edit these files or to access or modify certain devices (such as hard drives). When logged in as root, you have total control over your system, which can be dangerous.

When you work in root, you can destroy a running system with a simple invocation of the rm command like this:

# rm -fr /

This command line not only deletes files and directories, but also could wipe out file systems on other partitions and even remote computers. This alone is reason enough to take precautions when using root access.

The only time you should run Linux as the super-user is when booting to runlevel 1, or system maintenance mode, to configure the file system, for example, or to repair or main tain the system. Logging in and using Linux as the root operator isn't a good idea because it defeats the entire concept of file permissions.

Knowing how to run commands as root without logging in as root can help avoid serious missteps when configuring your system. Linux comes with a command named su that enables you to run one or more commands as root and then quickly returns you to normal user status. For example, if you would like to edit your system's file system table (a simple text file that describes local or remote storage devices, their type, and location), you can use the su command like this:

$ su -c 'nano -w /etc/fstab'

Password:

After you press Enter, you are prompted for a password that gives you access to root. This extra step can also help you 'think before you leap' into the command. Enter the root password, and you are then editing /etc/fstab, using the nano editor with line wrapping disabled.

CAUTION

Before editing any important system or software service configuration file, make a backup copy. Then make sure to launch your text editor with line wrapping disabled. If you edit a configuration file without disabling line wrapping, you could insert spurious carriage returns and line feeds into its contents, causing the configured service to fail when restarting. By convention, nearly all configuration files are formatted for 80-character text width, but this is not always the case. By default, the vi and emacs editors don't use line wrap.

You can use sudo to assign specific users or groups permission to perform specific tasks (similar to BSD UNIX and its 'wheel' group of users). The sudo command works by first examining the file named sudoers under the /etc directory; you modify this file with the visudo command. See the section 'Granting Root Privileges on Occasion — The sudo Command' in Chapter 10, 'Managing Users,' for details on how to configure and use sudo.

Creating Users

When a Linux system administrator creates a user, an entry in /etc/passwd for the user is created. The system also creates a directory, labeled with the user's username, in the /home directory. For example, if you create a user named bernice, the user's home directory is /home/bernice.

NOTE

In this chapter, you learn how to manage users from the command line. See Chapter 10 for more information on user administration with Fedora using graphical administration utilities, such as the system- config-users client.

Use the useradd command, along with a user's name, to quickly create a user:

useradd andrew

After creating the user, you must also create the user's initial password with the passwd command:

passwd andrew

Changing password for user andrew.

New password:

Retype new password:

passwd: all authentication tokens updated successfully.

Enter the new password twice. If you do not create an initial password for a new user, the user cannot log in.

You can view useradd's default new user settings by using the command and its

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату