Basic user managing

Here we go again. After several months (years?) whitout any interest in posting, I got an assignment in a Linux class, I have to write a serie of post about basic administration commands.

In this first post, I will write for you about basic user managing.

The useradd command and others.

This is the command to designed -as the name says- to add new users to the system It can be found in every Unix-like operating system (Linux for example).

At first look, its basis syntax is:

useradd [options] username

If we run useradd without any argument, it will show a brief explanation of its options (remember run this command as root).

Running useradd without parameters

From this brief explanation, we can extract that to create an user with login name foobar and its home directory at /home/foobar -by default, the home directory of each user will reside in the /home directory- we would use the following:

useradd -m foobar -G video,audio

Notice that we are using the -m option which is used to create the user directory. Also, we use the -G option with video,audio parameters, with this we are telling that we want create a user that belongs to the video and audio groups.

Now we have created a new user, but what is its password?, we can use the passwd command to set/update the password. The basis syntax is:

passwd [options] [LOGIN]

So, we can do passwd foobar to set a new password to the user foobar.

As a way to verify if the new user has been created, we can check the /etc/passwd file. Every time useradd is used, an entry to the /etc/passwd file is added. This file contains in one line, with seven fields delimited by colons (:), basic information about each user account.

The last line of a /etc/passwd file

The fields shown in the above image correspond to the user’s login name, password (or just the letter x if shaddow passwords are used), User Identification Number (UID), Group Identification Number (GID), a comment (optional), the user’s home directory and default shell (usually Bash on Linux).

But what is the shadow password?, Under Linux and other Unix-like operating systems, the /etc/shadow file is used to store actual passwords in encrypted format for user’s account.

Now we have learned how to create an user account on our system, now we will learn how to delete an user account. To perform this task, we will use the userdel command, which basis syntax is:

userdel [options] LOGIN

So, if we want to delete an user account together with its home directory, we will use:

userdel -r foobar

Delete an user account

Well, that’s all for this post. I hope this basic informatic helps you in somehow, remember read the man pages for further information about the use of commands.

Posted on 03 July 2012.  Tagged in: Basic Administration , Linux , UBB


New Blog!!

Well after several months without posts in crosvera.blogspot.com and lose all my codes from a free-web-hosting (0fees.net), I decided start a new blog but now from the GitHub Page system. This service is awesome, because you can use a git repository to manage your blog and use the MarkDown systax (and others) to write your posts. (very l33t style heh…)

Well, I hope to write some new stuff soon.

Posted on 01 November 2010.  Tagged in: github , blog


Hello World!

This is a test page =).

this is coding stuff
1 + 1 != 3

hola flanflisco =)

Posted on 05 April 2010.  Tagged in: helloworld , github


Template made by Harish Narayanan & edited by crosvera.