LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   SSH users (https://www.linuxquestions.org/questions/linux-networking-3/ssh-users-398203/)

jeucken 12-31-2005 02:31 PM

SSH users
 
Well it's almost new year and guess who has to re-install his SuSE server because of some security issues. :rolleyes:

Although the good side is that I'm going from SuSE 8.1 to SuSE 10.0. :)

Anyway, I'm having a problem with my SSH.
It is running and I can connect to it.

But when I try to login using a username that exists on the SuSE machine it gives an 'access denied'.

How can I give that user the rights to login to SSH?

(Makes the configuration of the thing a whole lot easier because the chair @ the desktop computer is much more comforting :cool:)

gilead 12-31-2005 02:48 PM

Can you post the output of the following please (hostname is the ssh server you are connecting to)?
Code:

ssh -v hostname

jeucken 01-01-2006 07:56 AM

Hmmm, how can I do that from Putty?
(please note: the computer I'm using to connect to the SuSE server is Win XP)

But I tried it also @ SuSE and when I tried to SSH to localhost it all went a-ok.

So apparently it just won't accept SSH logins from the outside.

gilead 01-01-2006 02:10 PM

Sorry, I did mean to run the `ssh -v` from your Linux box. From putty, you can turn on logging from Session / Logging / Log SSH packet data.

Have you tried to telnet to the SSH port on the Linux box from the Windows box? If the Suse box were at 192.168.1.5:

telnet 192.168.1.5 22

should display the SSH banner on the Linux box - I get `SSH-2.0-OpenSSH_4.2`.

If you can't connect then it may be the Windows firewall, the Suse firewall, or the Suse SSH configuration.

If it's firewall (packet) related...

If you have ethereal running on both boxes, you can check whether the SSH traffic leaving the Windows box arrives at the Suse box, or whether the return traffic leaving the Suse box is getting back to the Windows box. Just restrict ethereal with a `port 22` filter to cut down the data it collects.

If it's config related...

Are you running your SSH daemon standalone or out of inetd? You can check for ssh in /etc/inetd.conf. If so, look for entries in /etc/hosts.allow or /etc/hosts.deny that restrict remote access to ssh or ALL.

Do you have any settings in /etc/ssh_config that aren't global (look for a line beginning with `host`)? Do you have any settings in /etc/sshd_config that limit where the daemon will accept connections (look for lines beginning with ListenAddress)?

Sorry it's not more specific help :(

jeucken 01-02-2006 11:36 AM

Quote:

Originally Posted by gilead
Have you tried to telnet to the SSH port on the Linux box from the Windows box? If the Suse box were at 192.168.1.5:

telnet 192.168.1.5 22

should display the SSH banner on the Linux box - I get `SSH-2.0-OpenSSH_4.2`.

I get: 'SSH-1.99-OpenSSH_4.1'
Quote:

Are you running your SSH daemon standalone or out of inetd? You can check for ssh in /etc/inetd.conf.
It is started from /etc/init.d/rc3.d and /from/etc/init.d/rc5.d.
(SuSE 10.0 doesn't use inetd.conf, it uses xinetd.conf)
Quote:

If so, look for entries in /etc/hosts.allow or /etc/hosts.deny that restrict remote access to ssh or ALL.
hosts.allow is empty
hosts.deny says: http-rman: ALL EXCEPT LOCAL
Quote:

Do you have any settings in /etc/ssh_config that aren't global (look for a line beginning with `host`)?
It only has a couple of commented out hostkey lines.
Quote:

Do you have any settings in /etc/sshd_config that limit where the daemon will accept connections (look for lines beginning with ListenAddress)?
It has:
listenaddress 0.0.0.0
listenaddress ::

But these are also commented out.

Keep in mind that I can connect to the server using Putty. But if I insert my login name and the correct password it just gives an access denied.

WindowBreaker 01-02-2006 12:17 PM

jeucken:
It's not a firewall, because you can see the ssh banner when you telnet.
I don't think it's /etc/hosts.allow or hosts.deny, because you get a login prompt.
It's a simple case of your ssh server not allowing the username you're using to connect to it.
Make sure the following is in your /etc/sshd_config file:
Code:

AllowUsers user1 user2 user3
This lists the users which are allowd to connect via ssh.

Also make sure you DO NOT have the following line in your sshd_config file:
Code:

DenyUsers *
as this would deny all users (* is the wildcard).

If you have a "DenyUsers" entry, delete it or adjust it accordingly.

Let us know the results.

jeucken 01-02-2006 02:22 PM

Quote:

Originally Posted by WindowBreaker
Make sure the following is in your /etc/sshd_config file:
Code:

AllowUsers user1 user2 user3
This lists the users which are allowd to connect via ssh.

I didn't have AllowUsers in my sshd_config. But when I added it, I still got access denied.
Quote:

Also make sure you DO NOT have the following line in your sshd_config file:
Code:

DenyUsers *
as this would deny all users (* is the wildcard).

If you have a "DenyUsers" entry, delete it or adjust it accordingly.
DenyUsers isn't in my sshd_config.

My sshd_config:
Code:

#        $OpenBSD: sshd_config,v 1.70 2004/12/23 23:11:00 djm Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.

Port 22
#Protocol 2,1
#AddressFamily any
ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
#obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile        .ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable support for the deprecated 'gssapi' authentication
# mechanism to OpenSSH 3.8p1. The newer 'gssapi-with-mic' mechanism is included
# in this release. The use of 'gssapi' is deprecated due to the presence of
# potential man-in-the-middle attacks, which 'gssapi-with-mic' is not susceptible to.
#GSSAPIEnableMITMAttack no
 

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
UsePAM yes

#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression yes
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem        sftp        /usr/lib/ssh/sftp-server

# This enables accepting locale enviroment variables LC_* LANG, see sshd_config(5).
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL

Please note: Permitrootlogin is enabled at this time. But when SSHD is correctly running I will disable it.

gilead 01-02-2006 03:29 PM

Can I suggest that you change the following lines?

From:
Code:

#Protocol 2,1
To:
Code:

Protocol 2
From:
Code:

PasswordAuthentication no
To:
Code:

PasswordAuthentication yes
From (change this only if the above does not work):
Code:

UsePAM yes
To:
Code:

UsePAM no
Apart from X11Forwarding and the locale environment variables at the bottom of the file, those are the only security related differences to my sshd_config.

jeucken 01-03-2006 10:48 AM

Quote:

Originally Posted by gilead
Can I suggest that you change the following lines?

From:
Code:

#Protocol 2,1
To:
Code:

Protocol 2
From:
Code:

PasswordAuthentication no
To:
Code:

PasswordAuthentication yes

That did the trick!
Thanks :)

Up to the next problem :)

gilead 01-03-2006 12:50 PM

Glad to hear it :)

cblakework 05-31-2006 03:10 PM

I ran into this as well doing a scratch install of SUSE 10. The above solution worked perfectly!


All times are GMT -5. The time now is 02:49 PM.