How To Create User Accounts in Unix

If you want to quickly create a new user account in your Unix OS, it ca be done with just one line

Adding new user accounts in Unix

To create a basic Unix user account with default settings, you need to know only one thing: the username.

The reason I say it as one word is because username (quite often referred to as “login”) is not the actual name of the new person gaining access to your Unix system, but rather a single keyword uniquely identifying this user in your system. Most often, usernames are derived from real names of users – jsmith, johns or smithj for John Smith, just to give you a few examples.

The simplest way to add a new user to your system is to do run a command like this:

ubuntu# useradd jsmith

If you don’t get any errors thrown back at you, this means your command was executed successfully and you now have a new user. Use this command to verify:

ubuntu# finger jsmith
Login: jsmith                     Name:
Directory: /home/jsmith                 Shell: /bin/sh
Never logged in.
No mail.
No Plan.

If you attempt to create a user with existing username, you’ll obviously get an error:

ubuntu# useradd jsmith
useradd: user jsmith exists

Setting a password for the newly created user account

Once you have created new user, you’ll most likely need to have a new password assigned to it. Here’s how you do it:

ubuntu# passwd jsmith
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

As you can see from the example, you’ll be asked to type the new password twice, and it will be assigned to the user only if both inputs match.

See also:




New section on this blog: Unix Commands

I’ve just integrated a new section: Unix Commands. The long-term plan is to have a categorized list of commands with most common usage documented in my typical easy-to-follow examples.

So far, there’s not much, but I will referer to this section a lot in my future posts and its pages will have more examples for a particular Unix command compared to the original Unix Tutorial post where such a command is mentioned.

Have a look for yourself:

  • Unix Commands – the main index
  • Basic Unix commands – like it says, they really are basic. If you can think of something else which should be part of it, let me know
  • Advanced Unix commands – to Unix gurus they’ll seem basic as well, but my only guidance so far was that commands there will be the ones you don’t have to use on a daily basis. As I add more pages, this section will most likely become something like “Most common Unix commands” and a set of really advanced commands will be added.

Let me know what you all think, and if there are some immediate candidates for any of the section – let me know and I’ll add them to my list!

See Also