- slide 1 of 3
Is it "useradd" or "adduser"?
In the beginning the UNIX command was useradd. Somewhere along the line the command changed to adduser. In some flavors of Linux the useradd command has been dropped in favor of adduser. In some flavors of Linux however, both commands remain. In fact, if you are using certain Linux distributions (such as Mandriva) you can issue either man useradd or man adduser - both commands come up with the useradd man page. Thus useradd and adduser are essentially the same command.
So depending upon your distribution, you will either use adduser or useradd. If you try to use one and you receive "command not found", just use the other. Simple.
- slide 2 of 3
First and foremost, adduser can only be used by the root user. What this command does is add a new user to a system. It's fairly straight-forward and simple. Once you have root privileges (which can be either through su or sudo) at a bash prompt (using a terminal such as aterm, gnome-terminal, or konsole) the adduser command looks like this:
adduser [options] USERNAME
Where USERNAME is the actual name the user will log in with.
There are a number of options to be used with this command. The more important options are:
- d - This argument creates the home directory for the new user. You should define the new users home directory as their log in name. So if you use maryjane as your user login, the home directory will be /home/maryjane and the command would look like useradd maryjane -d /home/maryjane.
- m - If you have already created a user but failed to add a home directory, you can issue this argument with useradd (followed by the username) to create a home directory for the user.
- p - This will allow you to define the users password. The p argument is always followed by the actual password for the user. So, to add on to the above command, adding the user maryjane with a home directory of /home/maryjane and a password of 1mary2jane3, you would issue the command useradd maryjane -d /home/maryjane -p 1mary2jane3.
- slide 3 of 3
To any Linux administrator, having the adduser command available is an absolute necessity for so many tasks (adding users for mail servers, log ins, etc. The useradd command is simple to use but is often overlooked. If you have a gui-less server you will have to know how to add users via the command line.
Linux Command Line
- Linux Command Line: Introduction
- Linux Command Line: ls
- Linux Command Line: cd
- Linux Command Line: mkdir
- Linux Command Line: df
- Linux Command Line: ln
- Linux Command Line: top
- Linux Command Line: mount/umount
- Linux Command Line: Cron/Crontab
- Linux Command Line: chmod
- Linux Command Line: wget
- Linux Command Line: cat
- Linux Command Line: grep
- Linux Command Line: dd
- Linux Command Line: sudo
- Linux Command Line: startx
- Linux Command Line: adduser
- Linux Command Line: at
- Linux Command Line: aterm
- Linux Command Line: nano
- Linux Command Line: hostname