-D
option, like this:
# useradd -D
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes
These options display the default group ID, home directory, account and password policy (active forever with no password expiration), the default shell, and the directory containing defaults for the shell.
The useradd
command has many different command-line options. The command can be used to set policies and dates for the new user's password, assign a login shell, assign group membership, and manage other aspects of a user's account.
Deleting Users
Use the userdel
command to delete users from your system. This command removes a user's entry in the system's /etc/passwd
file. You should also use the command's - r
option to remove all the user's files and directories (such as the user's mail spool file under /var/spool/mail
):
# userdel -r andrew
If you do not use the -r
option, you have to manually delete the user's directory under /home
, along with the user's /var/spool/mail
queue.
Shutting Down the System
Use the shutdown
command to shut down your system. The shutdown
command has a number of different command-line options (such as shutting down at a predetermined time), but the fastest way to cleanly shut down Linux is to use the -h
or halt option, followed by the word now
or the numeral zero (0
), like this:
# shutdown -h now
or
# shutdown -h 0
To incorporate a timed shutdown and a pertinent message to all active users, use shut down's time and message options, like so:
# shutdown -h 18:30 'System is going down for maintenance this evening'
This example shuts down your system and provides a warning to all active users 15 minutes before the shutdown (or reboot). Shutting down a running server can be considered drastic, especially if there are active users or exchanges of important data occurring (such as a backup in progress). One good approach is to warn users ahead of time. This can be done by editing the system motd
file, which displays a message to users after login. To create your custom MOTD, use a text editor and change the contents of /etc/motd
. You can also make downtimes part of a regular schedule, perhaps to coincide with security audits, software updates, or hardware maintenance.
You should shut down Fedora for only a few very specific reasons:
> You are not using the computer and want to conserve electrical power.
> You need to perform system maintenance that requires any or all system services to be stopped.
> You want to replace integral hardware.
Do not shut down your computer if you suspect that one or more intruders has infiltrated your system; instead, disconnect the machine from any or all networks and make a backup copy of your hard drives. You might want to also keep the machine running to examine the contents of memory and to examine system logs. See Chapter 14 and Chapter 30, 'Securing Your Machines,' for how to protect and monitor a network-connected system.
Rebooting the System
You should also use the shutdown
command to reboot your system. The fastest way to cleanly reboot Linux is to use the -r
option and the word now or the numeral zero (0
):
# shutdown -r now
or
# shutdown -r 0
Both rebooting and shutting down can have dire consequences if performed at the wrong time (such as during backups or critical file transfers, which arouses the ire of your system's users). However, Linux-based operating systems are designed to properly stop active system services in an orderly fashion. Other commands you can use to shut down and reboot Linux are the halt
and reboot
commands, but the shutdown
command is more flexible.
Reading Documentation
Although you learn the basics of using Fedora in this book, you need time and practice to master and troubleshoot more complex aspects of the Linux operating system and your distribution. As with any operating system, you can expect to encounter some problems or perplexing questions as you continue to work with Linux. The first place to turn for help with these issues is the documentation included with your system; if you cannot find the information you need there, check Fedora's website.
Checking Fedora's website for security updates and bug fixes is a good idea. Browse to http://fedoraproject.org/wiki/. Alternatively, you can always do a quick yum update to make sure that your system has the most up-to-date software available.
Linux, like UNIX, is a self-documenting system, with man pages accessible through the man command. Linux offers many other helpful commands for accessing its documentation. You can use the apropos
command — for example, with a keyword such as partition
— to find commands related to partitioning, like this: