Linux Systems Administration
Most system administration
functions on UNIX and Linux are performed as user "root".
The root user is the superuser and is equivalent to the Windows "administrator"
account. It is dangerous. You can delete the whole Linux OS without
so much as an "are you sure?" prompt. The "root"
account is all-powerful and not something to play with, unless you have
your own system and do not mind reinstalling the OS daily. You are almost
never logged in as root when using a system- the root login is strictly
for configuration and administration of your system.
With that said, let's learn
a few additional commands that can only be run as root. There will not
be a lab for this lesson because you most likely do not have root access, unless you have your own system.
| su |
Switch user.
If you are logged in as a user, you can type in "su username"
and you will be given a log in prompt for username. You will
have to provide a password to actually log in. Typing "su"
without a username is equivalent to "su root" and you
will be prompted for the root password. |
| chown |
chown is
a standard UNIX/Linux command that allows you to change the owner
of a file/directory. To change the owner of a file/directory, become
root by either logging in directly as the user root or use the su
command as a normal user. Then you would type "chown newOwner
filename" where newOwner is the username you want to
change ownership to and filename is the name of the file or directory.
|
| chgrp |
chgrp is
a standard UNIX/Linux command that allows you to change the group
of a file/directory. To change the owner of a file/directory, become
root by either logging in directly as the user root or use the su
command as a normal user. Then you would type "chgrp newGroup
filename" where newGroup is the group-name you want
to change group ownership to and filename is the name of the file
or directory. |
| useradd |
This program
adds a user to the system. For example, you can type useradd
foobar to add the user foobar to the system. If you type
useradd -m foobar, foobar will be added to the system and a
home directory will be created. If you add a user to the system,
you must add a password before they can use the account |
| passwd |
This command
changes the password on an account. In order to change (or add)
foobar's password, root would type passwd foobar .
If a user runs the command, passwd, he or she will be prompted
for a new passwd for their own account. |
| userdel |
This command
is used to delete a user from the system. Only root can run this
program by typing userdel username . If you want to delete
the user's home directory at the same type, use an -r switch. userdel
-r username |
|