Friday, August 5, 2011

Add New user on Ubuntu

This post will tell u how to add new user in in ubuntu server. so u can have a few user on server. Ubuntu Server is like any Linux variety, and has full multi-user capabilities, and a common task on any server is adding users.


The useradd command will let you add a new user easily from the command line:

useradd <username>

You can use the -d option to set the home directory for the user. The -m option will force useradd to create the home directory. We’ll try creating a user account with those options, and then use the passwd command to set the password for the account. You can alternatively set a password using -p on the useradd command, but I prefer to set the password using passwd.

sudo useradd -d /home/newuser -m newuser

sudo passwd newuser

This will create the user named newuser and give them their own home directory in /home/newuser. The files in the new home directory are copied from the /etc/skel folder, which contains default home directory files. If you wanted to set default values for your users, you would do so by modifying or adding files in that directory. If we take a look at the new home directory for the user:

unyil@ubuntuServ:/etc/skel$ ls -la /home/newuser
total 20
drwxr-xr-x 2 newuser newuser 4096 2011-08-02 11:34 .
drwxr-xr-x 5 root root 4096 2011-08-02 11:37 ..
-rw-r–r– 1 newuser newuser 220 2011-08-02 11:34 .bash_logout
-rw-r–r– 1 newuser newuser 414 2011-08-02 11:34 .bash_profile
-rw-r–r– 1 newuser newuser 2227 2011-08-02 11:34 .bashrc

look that there are bash scripts in this directory. If you wanted to set default path options for all new users, then u got to modify file in /etc/skel, which would then be used to create these files by the useradd command.


The adduser command is even easier than the useradd command, because it prompts you for each piece of information. I find it slightly funny that there are two virtually identically named commands that do the same thing, but that’s linux for you. Here’s the syntax:

adduser <username>


unyil@ubuntuServ:/etc/skel$ sudo adduser unyil
Adding user `unyil’…
Adding new group `unyil’ (1004).
Adding new user `unyil’ (1004) with group `unyil’.
Creating home directory `/home/unyil’.
Copying files from `/etc/skel’
Enter new UNIX password:
Retype new UNIX password:
No password supplied
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for unyil
Enter the new value, or press ENTER for the default
Full Name []: The Geek
Room Number []: 0
Work Phone []: 555-0808
Home Phone []: 555-0808
Other []:
Is the information correct? [y/N] y simple hah…now u can add multiple user on your ubuntu server easily..

1 Comentário:

kinra sony said...

your blog very helpful for me.keept up. Here we leave a comment for What To Do When Your Bored.We at free online tricks, What To Do When Your Bored, What can you possibly do if there is nothing else constructive? So many of us often feel bored, don’t know what to do and our mood changes.Here some online tricks on what
to do when your bored.

What To Do When Your Bored

Post a Comment



Komentar Terakhir

  ©Design By Unyil 2010