Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to figure out why my industrial appliance (x86, running kernel 2.6.21.7 and OpenSSH_4.3p2 / OpenSSL 0.9.7m) accepts ssh connections without asking for a password (even for root)!
When I log on to the local console as root I have to enter a password but strangely this prompt won't appear using a ssh connection (although I'm not using any client certificates).
Of course that not acceptable but I just can't find the related configuration entry to disable this "password-less" authentification.
Is this related to the sshd or has it something to do with the PAM module?
Thanks for any help!
- Update ->
While looking at /var/log/secure, I've found the following lines:
Jul 18 16:55:07 localhost sshd[5712]: Accepted none for root from XXX port 6393 ssh2
Jul 18 16:55:07 localhost sshd[5712]: Deprecated pam_stack module called from service "sshd"
Jul 18 16:55:07 localhost sshd[5712]: Deprecated pam_stack module called from service "sshd"
Jul 18 16:55:07 localhost sshd[5712]: pam_unix(sshd:session): session opened for user root by (uid=0)
Distribution: Ubuntu, Debian, Fedora, Oracle Linux
Posts: 109
Rep:
Quote:
Originally Posted by oxident
Hello.
I'm trying to figure out why my industrial appliance (x86, running kernel 2.6.21.7 and OpenSSH_4.3p2 / OpenSSL 0.9.7m) accepts ssh connections without asking for a password (even for root)!
When I log on to the local console as root I have to enter a password but strangely this prompt won't appear using a ssh connection (although I'm not using any client certificates).
Of course that not acceptable but I just can't find the related configuration entry to disable this "password-less" authentification.
Is this related to the sshd or has it something to do with the PAM module?
Thanks for any help!
- Update ->
While looking at /var/log/secure, I've found the following lines:
Jul 18 16:55:07 localhost sshd[5712]: Accepted none for root from XXX port 6393 ssh2
Jul 18 16:55:07 localhost sshd[5712]: Deprecated pam_stack module called from service "sshd"
Jul 18 16:55:07 localhost sshd[5712]: Deprecated pam_stack module called from service "sshd"
Jul 18 16:55:07 localhost sshd[5712]: pam_unix(sshd:session): session opened for user root by (uid=0)
Try posting the /etc/ssh/sshd_config to check the parameters.
Or just verify the your /etc/ssh/sshd_config contains the follow instruction:
PermitRootLogin no
that is always a good minimum security policy to follow....
#Port 22
#Protocol 2,1
Protocol 2
#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
SyslogFacility AUTHPRIV
#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 yes
#PermitEmptyPasswords no
PermitEmptyPasswords yes
PasswordAuthentication yes
# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes
# 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 no
UsePAM yes
# Accept locale-related environment variables
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
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
# no default banner path
#Banner /some/path
# override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server
But I really want to allow root login using ssh. My only problem is that I need SSHd to ask for the account's password.
Please read some literature on Password less SSH login in google( which is normally used in automation, with scripts without any user intervention). It is advisable to disable direct ssh login for root for security reasons.
Here is a link to help you on password less login, which someone might have configured on your system. Password Less Login
Yes, I have already read a lot regarding password-less login (and I also use the process for scripting issues on other machines) but every site, I've visited deals with client-side certificates. As far as I've understood your link, this involves generating a certificate which is used to authentificate with the server.
But in my case, there's definitely no kind of certificate installed. I can even login from my mobile phone as root without entering any password.
I would have no problem with disabling root access via ssh, but my sshd won't even prompt for a password when using different accounts!
Distribution: Ubuntu, Debian, Fedora, Oracle Linux
Posts: 109
Rep:
Quote:
Originally Posted by oxident
Yes, I have already read a lot regarding password-less login (and I also use the process for scripting issues on other machines) but every site, I've visited deals with client-side certificates. As far as I've understood your link, this involves generating a certificate which is used to authentificate with the server.
But in my case, there's definitely no kind of certificate installed. I can even login from my mobile phone as root without entering any password.
I would have no problem with disabling root access via ssh, but my sshd won't even prompt for a password when using different accounts!
One or more line(s) to change:
PermitEmptyPasswords yes => change this to no
This should solve your doubts about root without password login: this is an HUGE security hole, I think you should change this as soon as possible!
Also you should:
1.) as root generate a DSA and a RSA server key
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_dsa_key
2.) enable the following config lines:
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
3.) enable strictModes
StrictModes yes
4.) enable the following (key authentication):
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
This should solve your doubts about root without password login: this is an HUGE security hole, I think you should change this as soon as possible!
Thanks for this hint. If I change this setting I'm not able to log in using keyboard/interactive authentification anymore ("login permitted")
I think, the problem is that there's is no user with an empty password (although sshd won't ask for a password)!
Before implementing the certificate security I would really like to "restore" the behaviour to what I know from other Linux installation (which means: root login is disabled and other users can login in with their passwords)...
Distribution: Ubuntu, Debian, Fedora, Oracle Linux
Posts: 109
Rep:
Quote:
Originally Posted by oxident
Thanks for this hint. If I change this setting I'm not able to log in using keyboard/interactive authentification anymore ("login permitted")
I think, the problem is that there's is no user with an empty password (although sshd won't ask for a password)!
Before implementing the certificate security I would really like to "restore" the behaviour to what I know from other Linux installation (which means: root login is disabled and other users can login in with their passwords)...
Weel, to permit password authentication just set the parameter:
PasswordAuthentication yes
On that linux box does exist the specific user with a valid password?
Try posting the output from a client point of view (using ssh -vvv user@IP or similar).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.