O login do console SSH está funcionando, mas o SFTP não funciona, por quê?

12

Estou tentando fazer SFTP com o Filezilla, mas ele não consegue se conectar ao servidor e acho que isso se deve às minhas regras de firewall?

Eu posso SSH absolutamente bem. A porta para SSH é 6128. Alguém pode me dizer quais alterações eu teria que fazer para permitir uma conexão FTP através de SSH, dado que o SSH já está funcionando?

(Aqui estão minhas regras de IPtables)

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
fail2ban-ssh  tcp  --  anywhere             anywhere             multiport dports ssh
ACCEPT     all  --  anywhere             anywhere
REJECT     all  --  anywhere             loopback/8           reject-with icmp-port-unreachable
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     udp  --  anywhere             anywhere             udp dpt:9987
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:10011
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:30033
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:6128
ACCEPT     icmp --  anywhere             anywhere             icmp echo-request
LOG        all  --  anywhere             anywhere             limit: avg 5/min burst 5 LOG level debug prefix "iptables denied: "
DROP       all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere

Chain fail2ban-ssh (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere
    
por tentimes 15.06.2015 / 13:08

5 respostas

6

Para acessar seu sftp de outros hosts, certifique-se de que o seguinte esteja instalado e configurado corretamente.

  • Servidores OpenSSH instalados
  • Configurado sshd_config
    • PubkeyAuthentication yes
    • Subsistema sftp interno-sftp
  • Adicionou sua chave pública em ~ / .ssh / authorized_keys

  • Inicie o servidor ssh com a porta 22 / TCP aberta # /etc/init.d/sshd start

  • # iptables -I INPUT -j ACCEPT -p tcp --dport 22

Finalmente, teste $ sftp <login>@<hostname>

    
por 15.06.2015 / 14:31
1

Seu software antivírus também pode causar isso. Nós enfrentamos recentemente. ssh via PuTTY estava funcionando bem, mas o WinSCP não conseguiu se conectar. Começou a trabalhar assim que uma exceção foi configurada no Antivírus.

    
por 24.02.2016 / 09:40
1

No meu caso, o usuário tinha zsh no topo do seu arquivo .bashrc, para que ele pudesse cair no shell zsh em vez de bash.

bash era seu shell padrão. Remover isso resolveu o problema. Eu então chsh user -s /bin/zsh para o usuário manter o zsh como seu shell padrão.

    
por 12.05.2017 / 08:23
0

Você tem algum texto indo para o console (por exemplo, instruções echo) em qualquer um dos seus arquivos .profile, como .bashrc ? Isso pode mexer com conectividade sftp. Veja minha resposta a uma pergunta semelhante em serverfault

    
por 08.09.2015 / 13:38
0

Se você estiver usando o filezilla, a seguinte resposta me ajudou:

link

In Filezilla, choose on the menu Edit->Settings, On the left panel expand to Connection->SFTP. On the right side make sure you have the correct private key file, or add if missing the correct entry.

Using the DO web console, login as root and do 'tail -f /var/log/auth.log'. Then try to login with Filezilla and note any messages.

    
por 04.09.2017 / 21:32

Tags