Estou tentando conectar a um servidor Ubuntu 14.04 LTS com o seguinte comando: sftp -P xx user@host
(o servidor ssh está configurado para escutar uma porta diferente). O usuário com o qual estou tentando efetuar login é a conta de usuário principal no servidor (aquela que eu desisti durante a instalação do servidor). Toda vez que tento me conectar ao servidor usando sftp
, recebo a mensagem Connection closed
.
Tenho certeza que tem algo a ver com algumas adições que fiz em sshd_config
, mas não vejo onde isso está dando errado. Aqui está todo o sshd_config
:
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 2222
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp internal- sftp
# 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 yes
Match Group sftpusers
ChrootDirectory /var/www/Vassens
# XllForwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
A conta de usuário principal com a qual estou tentando fazer o login é não como membro do grupo 'sftpusers'. Consegui fazer o login como outro usuário que é um membro de 'sftpusers'.
Isso é o que acontece após uma autenticação bem-sucedida quando estou tentando se conectar:
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LC_PAPER = nl_NL.UTF-8
debug1: Sending env LC_ADDRESS = nl_NL.UTF-8
debug1: Sending env LC_MONETARY = nl_NL.UTF-8
debug1: Sending env LC_NUMERIC = nl_NL.UTF-8
debug1: Sending env LC_TELEPHONE = nl_NL.UTF-8
debug1: Sending env LC_IDENTIFICATION = nl_NL.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_MEASUREMENT = nl_NL.UTF-8
debug1: Sending env LC_TIME = nl_NL.UTF-8
debug1: Sending env LC_NAME = nl_NL.UTF-8
debug1: Sending subsystem: sftp
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 4672, received 2772 bytes, in 0.6 seconds
Bytes per second: sent 7385.2, received 4381.8
debug1: Exit status 127
Connection closed
Idealmente, eu poderia logar com sftp
com a conta de usuário principal, para poder transferir arquivos do meu laptop para o meu servidor para qualquer diretório que eu desejasse e ao mesmo tempo manter o grupo de 'sftpusers' para /var/www/
.
Alguém sabe como eu poderia fazer isso? Eu aprecio muito a sua ajuda! Btw, eu sou capaz de acessar o servidor na conta de usuário principal usando ssh
.