SSH console login working but SFTP does not, why

sftpssh

I am trying to SFTP with Filezilla but it is not able to connect to the server and I think this is due to my firewall rules?

I can SSH absolutely fine. The port for SSH is 6128. Can anyone tell me what changes I would have to make to allow an FTP connection over SSH given that SSH is already working?

(Here are my IPtables rules)

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

Best Answer

To access your sftp from other hosts, please make sure following is installed and configured properly.

  • Installed OpenSSH servers
  • Configured sshd_config
    • PubkeyAuthentication yes
    • Subsystem sftp internal-sftp
  • Added your public key to ~/.ssh/authorized_keys

  • Start the ssh server with port 22/TCP open # /etc/init.d/sshd start

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

Finally, test $ sftp <login>@<hostname>

Related Question