# ssh connection problems

## demonace

i am having a problem connecting to my gentoo box with ssh as any user other than root.

i can ssh from another linux box(mandrake) or using putty on a win box and log in as root.

useing a username always gives me auth problems. but i can use the user name in a local login and it works fine. All i can think of is that the sshd is not reading the passwords properly.

i get the key host key fine.

I'm not familer with openssh setup enough to know what to look for. any ideas?

i have also tried "emerge openssh" again. and no luck.

i have also made sure several times that the password is correct.

i'm at a loss at the moment.

----------

## anonymous coward

SSH is not set up automagically.  You will need to edit  some conf files.  Man sshd for more information.  Basically you have to allow users or groups in sshd conf file.

----------

## demonace

I have looked at a working SSH setup and edited the gentoo machine setup. still can log in as root, not as user.

was there info that i missed after openssh installed?

----------

## warren smith

i am also having the same problem.

line from passwd:

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

i copied the sshd_config from a working box as well, with no luck. Also tried AllowUsers/AllowGroups commands in config file.

----------

## Nitro

I have ssh running with just the following in my config file:

```
Port 22

Protocol 2

ListenAddress 0.0.0.0
```

Might want to take a look at the permissions on the user's home directory too.  If permissions aren't the problem, make sure you did set a password (everyone forgets the simple things sometimes  :Wink: ).  If you are still having problems, look for authentication failure information in you you log files (directory is: /var/log/ ) and post it here.

----------

## warren smith

got it! it was in the sshd_config file. thanks!

----------

## demonace

Apr 16 13:58:07 [sshd] debug1: Starting up PAM with username "demonace"

Apr 16 13:58:07 [sshd] debug3: Trying to reverse map address 192.168.1.42.

Apr 16 13:58:07 [sshd] debug1: PAM setting rhost to "host"

Apr 16 13:58:07 [sshd] debug1: Attempting authentication for demonace.

Apr 16 13:58:13 [sshd] debug1: PAM Password authentication for "demonace" failed[7]: Authentication failure

This is the error message, i setup LogLevel DEBUG3 in the sshd_config file.

i have reset the password to several times, and i don't know why i can't login non root.

----------

## Nitro

Can you give me the contents of /etc/pam.d/sshd?

My /etc/pam.d/sshd contains:

```
#%PAM-1.0

auth       required     pam_stack.so service=system-auth

auth       required     pam_shells.so

auth       required     pam_nologin.so

account    required     pam_stack.so service=system-auth

password   required     pam_stack.so service=system-auth

session    required     pam_stack.so service=system-auth
```

----------

## demonace

here is my /etc/pam.d/sshd

```

#%PAM-1.0

auth       required     pam_stack.so service=system-auth

auth       required     pam_shells.so

auth       required     pam_nologin.so

account    required     pam_stack.so service=system-auth

password   required     pam_stack.so service=system-auth

session    required     pam_stack.so service=system-auth

```

its the same as what your sys has

but i found the problem when i was going to include part of my /etc/passwd

```

demonace:x:1004:100::/home/demonace:

```

i fixed it to

```

demonace:x:1004:100::/home/demonace:/bin/bash

```

and now i can login, it seems that useradd is broken

or i'm just used to /bin/bash being included automaticly

----------

## Cr0t

thx man i had the same problem 

 :Wink: 

----------

## Nitro

 *demonace wrote:*   

> it seems that useradd is broken
> 
> or i'm just used to /bin/bash being included automaticly

 

If you want to set your default shell to /bin/bash do:

```
useradd -D -s /bin/bash
```

----------

## pjp

From Bugs to Networking & Security.

----------

