# creating new users

## hudsonhauck

Whenever I try to add a new user, say for example:

```
useradd -p asdf johnDoe
```

, then I try to login as johnDoe, it tells me "Login Failed".  I have tried changing the group, changing the password to make sure I got it right, changing every "usermod" I could and it never would let me log in!! What the hell!!

----------

## DArtagnan

simply type:

#groupadd [group name]

#adduser_command -g [group you've entered] -s /bin/bash -d /home/[user] -m

There are more options...

----------

## hudsonhauck

Ok, I can log into my other accounts now, but which groups should they be in?  Right now, with no group specified, I can't even go into my ~/.fluxbox folder to edit the default menubar that has  only xterm, restart, and exit.

----------

## DArtagnan

you should make a group named as username [ not a must ]

For example:

to be able to connect as SU ( supper user ) your user must be in "wheel" group.

mine looks like that:

i made my own group:

#groupadd liviu

#useradd -g liviu -d /home/liviu -s /bin/bash liviu -m

Here i was added an user named "liviu" in group "liviu"

Then i added this user to group wheel too:

#man groupmod

( i don't remmember the command because i'm in win now )

pacman

----------

## DArtagnan

 *Quote:*   

> Right now, with no group specified, I can't even go into my ~/.fluxbox folder to edit the default menubar that has only xterm, restart, and exit.

 

I did not understand

----------

## hudsonhauck

My user privelages are really messed up.  I have a user named matt.  matt is in wheel group.  matt cannot create any files even in his  own directory!! Why???

----------

## DArtagnan

login as root and enter in matt home dir.

run there ls -la and make sure the owner is mat:

1) #ls -la /home

2) #ls -la /home/matt

If matt is not owner then make changes:

#chown matt:matt file_name_here

and so on....

----------

## hudsonhauck

Nope, the /home/matt folder belongs to "users" as to matt's files

----------

## tomte

this should fix your problem

```
$> usermod -g users -G wheel,audio,video,... -s /bin/bash -d /home/matt matt

$> chmod -R matt.users /home/matt
```

look at -g and -G: with -g you specifie the primary group, with -G additional groups the user should belong to, so replace the ellipsis with whatever is needed. 

If this doesn't fix your problem, you should post the output  of

```

$> ls -la /home/matt

$> grep matt /etc/passwd

```

to give us a clue on whats going wrong

regards,

tom

----------

## hudsonhauck

I got it.  Even though /home/matt was owned by users, /home was still owned by the root (i don't know why).  After I chown :users /home, everything worked fine.  Thanks guys for your help. (I didn't understand the diff between -g and -G, but now, I do)

----------

## tomte

 *hudsonhauck wrote:*   

> I got it.  Even though /home/matt was owned by users, /home was still owned by the root (i don't know why).  After I chown :users /home, everything worked fine. 

 

This may solve your problem, but it's wrong: /home should belong to root.root, /home/matt should belong to matt.users and the permissions should look like this:

```

$> ls -l /home

total 4

 drwxr-xr-x   59 matt      users        4096 May 20 21:30 matt

```

regards,

tom

----------

## hudsonhauck

Ok, I didn't know that. I changed /home back to root.root.  then i did what you told me to do   3 posts back and I got this:

```
 bash-2.05a# chmod -R matt.users /home/matt

chmod: invalid mode string: `matt.users' 
```

Here is the othere stuff you wanted.

```
 bash-2.05a# ls -la /home/matt

total 416

drwxr-xr-x    5 matt     users        4096 May 20 13:05 .

drwxr-xr-x    6 root     root         4096 May 19 20:38 ..

-rw-------    1 matt     users           0 May 20 13:05 .Xauthority

-rw-r--r--    1 222      users         438 May 19 20:16 ._cfg0000_.bash_profile

-rw-r--r--    1 222      users         397 May 19 20:16 ._cfg0000_.bashrc

-rw-------    1 matt     users        1397 May 20 13:05 .bash_history

drwx------    2 matt     users        4096 May 20 12:27 .fluxbox

drwxr-xr-x    4 matt     users        4096 May 20 12:28 .mozilla

-rw-r--r--    1 matt     users           5 May 20 12:54 .wmix.pidq?

-rw-r--r--    1 matt     users         123 May 20 12:27 .xinitrc

drwxr-xr-x    4 matt     users        4096 May 20 12:46 .xmms

-rw-------    1 root     root       378334 May 19 23:10 hotkeys_0.5.4.tar.gz 
```

and

```
 bash-2.05a# grep matt /etc/passwd

matt:x:1000:100::/home/matt:bin/bash 
```

----------

## tomte

o *hudsonhauck wrote:*   

> Ok, I didn't know that. I changed /home back to root.root.  then i did what you told me to do   3 posts back and I got this:
> 
> ```
>  bash-2.05a# chmod -R matt.users /home/matt
> 
> ...

 

Ooooops, my fault, chmod should read chown (just to make sure everything in your home-dir belongs to the user matt)

 *hudsonhauck wrote:*   

> 
> 
> Here is the othere stuff you wanted.
> 
> ```
> ...

 

the last line is a problem, the shell entry "bin/bash" should read "/bin/bash", a typo?

 beside this I'm out of luck: your home dir is yours, a shell entry is there (you can correct it with "usermod -s /bin/bash matt"), this output allowed me to just check the basic possible errors  :Sad: 

besides that: there is a file that belongs to root.root in matts home-dir; you should never work as root, perform just the absolutly necessary steps as root!

regards,

tom

----------

## hudsonhauck

Cool, that works now.  It must have been that one root file in there then, I guess.  The reason I was working as root was becuase I couldn't do anything as matt.  Thanks for the help.

----------

