SSH console login working but SFTP does not, why?
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>
In my case, the user had zsh
at the top of his .bashrc file, so that he could drop into zsh shell instead of bash.
bash was his default shell. Removing this solved the issue. I then chsh user -s /bin/zsh
for the user to retain zsh as his default shell.
Do you have any text going to the console (e.g. echo statements) in any of your .profile files such as .bashrc
? This can mess with sftp connectivity. See my answer to a similar question on serverfault