LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   SSH autologin FreeBSD -> CentOS5 (https://www.linuxquestions.org/questions/linux-general-1/ssh-autologin-freebsd-centos5-713105/)

Ghostwheel 03-20-2009 08:06 AM

SSH autologin FreeBSD -> CentOS5
 
I am trying to set up a script that will copy files from a CentOS5.x server to a FreeBSD server (well, the BSD pulls the files to itself). I have set up a few BSD->BSD servers with this config already so I'm not asking how I do it, it just isn't working from the BSD server to the CentOS server. When I try to log in it asks for a password.

I've been beating my head on something that should be dead simple for about a day now. Help please!

sshd_config from CentOS
Code:

#  $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

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

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

# 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
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 30
PermitRootLogin no
#StrictModes yes
MaxAuthTries 3

#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
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


blackhole54 03-21-2009 06:14 AM

Quote:

Originally Posted by Ghostwheel (Post 3482015)
When I try to log in it asks for a password.

So I gather you are trying to log in with a key? If so, the server is very particular about the permissions for the authorized_keys file. If that file or anything in its path (including /home/user or /home/user/.ssh) is writable by group or world then the server will refuse to auththenticate with that file, which could be where the password prompt is comming from.

Ghostwheel 03-23-2009 02:31 PM

Quote:

Originally Posted by blackhole54 (Post 3482998)
So I gather you are trying to log in with a key? If so, the server is very particular about the permissions for the authorized_keys file. If that file or anything in its path (including /home/user or /home/user/.ssh) is writable by group or world then the server will refuse to auththenticate with that file, which could be where the password prompt is comming from.

/home/user is 700, /home/user/.ssh is 600

anomie 03-23-2009 02:36 PM

Check /var/log/secure on the CentOS (sshd server) side. It may provide clues about why pubkey authentication is not taking.

Ghostwheel 03-23-2009 02:47 PM

Ok, found out that was wrong. Reset my home directory to 755 and it works like a charm!

blackhole54 03-24-2009 12:26 AM

Quote:

Originally Posted by Ghostwheel (Post 3485322)
Reset my home directory to 755 and it works like a charm!

Interesting! I don't understand why the additional permissions (x55) would be required :scratch: But, as long as you got it working ... :)

For the record, I just tried and public key authentication did not work when I set /home/user/.ssh to 600, but does work when set to 700 (where it has always been).

anomie 03-24-2009 11:51 PM

Quote:

Originally Posted by blackhole54
For the record, I just tried and public key authentication did not work when I set /home/user/.ssh to 600, but does work when set to 700 (where it has always been).

Good catch -- I missed that at first read. His latest 755 permissions are not necessary at the home directory level or at the ~/.ssh level. He could have just changed ~/.ssh to 700.


All times are GMT -5. The time now is 01:14 PM.