Information Technology Reference
In-Depth Information
Because a default base and group were defined, the
user2
account is a mem-
ber of the
other
group and has a home directory of
/export/home/user2
.
User accounts created with the
useradd
command do not have a password. These
accounts are locked and cannot be used until a password is set for the account using
the
passwd(1)
command.
Modifying an Account Using the usermod Command
The
usermod(1M)
command is used to modify an existing user account. The
command-line arguments are identical to the
useradd
command-line argu-
ments with the following exceptions:
The base directory (
-b
) is not available. Use
-d
to specify a new directory.
Don't forget to include the
-m
if the directory doesn't exist.
➤
The set default (
-D
) is not available.
➤
The template directory (
-k
) is not available.
➤
A new user account name is specified using
-l
account
if the account
name is being modified.
➤
Keep in mind that if the account name is changed, the name of the home
directory does not change unless the
-d
and
-m
command-line arguments are
used. The following example shows the
usermod
command changing the
name of the
user1
account to
user3
.
# ls -l
total 22
drwx------ 2 root root 8192 Jan 13 21:05 lost+found
drwxr-x--- 2 user3 other 512 Mar 31 13:23 user1
drwxr-x--- 2 user2 other 512 Mar 31 13:45 user2
#
# usermod -luser3 -d /export/home/user3 -m user1
6 blocks
#
# ls -l
total 22
drwx------ 2 root root 8192 Jan 13 21:05 lost+found
drwxr-x--- 2 user2 other 512 Mar 31 13:45 user2
drwxr-x--- 2 user3 other 512 Mar 31 13:23 user3
#
Deleting an Account Using the userdel Command
The
userdel(1M)
command is used to delete a user account. The user account
is specified as a command-line argument. Only one other command-line