PreviousNextContents


Adding New Users

It is generally accepted as a bad habit to be logged in as the root user any more than is necessary for system setup and maintenance. Since the root user has the rights to do almost anything, its just too easy to make a mistake and wipe out user data or critical parts of your system.

As soon as possible you should add new user logins for your normal day-to-day use. This may be done with the adduser and passwd commands, which must be done while logged in as root.

As a simple example, I will create a new user named gomer, with a password of golly-98:

adduser gomer

passwd gomer

golly-98

golly-98


If you are part of a network that shares NFS mounts, you will want to use the long form useradd command instead. You will need to know the uid and gid assigned by your network administrator. The below example assumed uid=2001 and gid=100 for the user gomer:

useradd -u 2001 -g 100 -d /home/gomer -s /bin/bash -c "I'm a gomer" gomer


Here's the result of a finger command for the user gomer:

finger gomer

Login: gomer                            Name: I'm a gomer
Directory: /home/gomer                  Shell: /bin/bash
Never logged in.
No mail.
No Plan.
And here's a directory of gomer's new home directory:

ls -al /home/gomer/

total 7
drwx------   2 gomer    users        1024 Feb 21 17:30 .
drwxr-xr-x  13 root     root         1024 Feb 21 17:30 ..
-rw-r--r--   1 gomer    users        1155 Feb 21 17:30 .Xdefaults
-rw-r--r--   1 gomer    users          24 Feb 21 17:30 .bash_logout
-rw-r--r--   1 gomer    users         230 Feb 21 17:30 .bash_profile
-rw-r--r--   1 gomer    users         124 Feb 21 17:30 .bashrc
 

Lastly don't forget to change the directory attributes for this user:

chmod 0755 /home/gomer


PreviousNextContents