Posts Tagged ‘fedora’

Ok so you set up your Linux distro on your Box properly.. but you dont want to always use your root account? So lets create a new account just for you! I understand that this post might look a bit redundant because almost all Linux Distros these days come with a very simple, straight forward GUI solutions to create and manage users and groups. I just think knowing how to do it through bash can sometimes be useful, plus it’s a hell of alot faster!

Step 1 Create the Account

Creating a New user Account:

Default Syntax:

useradd [-c comments]

[-d home_directory]

[-e expire_date]

[-g initial_group]

[-G group1,group2,….]

[-s shell]

[-u uid]

Ok so all these different arguments can be typed in one line, dont try to type them out in different lines… Almost all of them are pretty self explanatory. You’ll see that -g and -G are two different arguments, yes linux makes a huge fuss about capital and simple letters ( geekdomain and Geekdomain and two different user accounts in linux).

Please realize that UID is NOT the user name.. that’s the User ID, which is a numerical value.
Examples :

useradd -c test_account -g users geek   (Here the comment is “test_account” the account has a initial group of “users” and username of geek)

useradd -g root geek (here a new user is added, with a initial group of “root” and username of geek”)

By now you must have noticed that you DONT need to actually type out ALL the arguments, linux will use the default value if you dont type them in.

Step 2 Set a password for the account

Syntax:

passwd user_name

Type this out, press enter and when prompted for, enter the new password for that account!

Example:

passwd geek

(press enter)

(type in new password)

Advertisements