Назад | Перейти на главную страницу

Удаленный вход по SSH заблокирован без локального входа в Gnome

Я установил CentOS 6.7 с полного установочного носителя на настольную машину дома. sshd был перенастроен только для аутентификации с закрытым ключом.

Когда я захожу в систему через SSH со своего ноутбука (OS X Yosemite, в той же локальной сети) в Linux, это будет работать только тогда, когда я действительно вошел в систему через Gnome локально. Ошибка аутентификации отсутствует, она просто блокируется и в конечном итоге истекает. Как только я вхожу в систему локально через Gnome, я могу войти в систему удаленно. Как только я выхожу из системы через Gnome локально, удаленное SSH-соединение снова блокируется (включая открытые соединения). Если я снова вхожу в систему локально, соединения снова разблокируются. У меня никогда не было этой проблемы при подключении к удаленным серверам (AWS, другим поставщикам VPS).

Почему блокируется удаленный вход в систему без наличия локального входа?

Вот и весь соответствующий конфиг (надеюсь).

ls -al ~/.ssh

drwx------.  2 chris chris 4096 Sep 16 09:25 .
drwx------. 35 chris chris 4096 Sep 16 11:28 ..
-rw-------.  1 chris chris  391 Sep 16 09:25 authorized_keys
-rw-------.  1 chris chris 3311 Sep 15 17:53 id_rsa
-rw-r--r--.  1 chris chris  737 Sep 15 17:53 id_rsa.pub
-rw-r--r--.  1 chris chris  416 Sep 15 18:02 known_hosts

chkconfig | grep ssh

sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off

iptables --list

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh 
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

cat /etc/ssh/sshd_config

#   $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 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/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
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# Disable legacy (protocol version 1) support in the server for new
# installations. In future the default will change to require explicit
# activation of protocol 1
Protocol 2

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

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

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys
#AuthorizedKeysCommand none
#AuthorizedKeysCommandRunAs nobody

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

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

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

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials no
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange 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 and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to '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 LANGUAGE
AcceptEnv XMODIFIERS

#AllowAgentForwarding yes
#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
UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem   sftp    /usr/libexec/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   ForceCommand cvs server

Решено. Проблема заключается в том, что сетевые подключения были настроены с помощью NetworkManager, который Gnome не запускает, пока не произойдет вход в систему. Это также срывает их, когда вы выходите из системы. Тьфу.

Нет больше NetworkManager, больше нет проблем.

Это происходит из-за вашего Настройки NetworkManager для сетевого интерфейса.

Вам нужно убедиться, что обе из этих настроек включены:

  • Подключаться автоматически
  • Доступно всем пользователям

По умолчанию для беспроводной такое соединение, как ваше, «Доступно всем пользователям» по умолчанию отключено. По умолчанию это включено только для проводной соединения.

Если задано, эти настройки вызывают активацию соединения во время загрузки, а не привязку к пользователю, и в этом случае они активируются только тогда, когда этот пользователь входит в систему с консоли.