When using sftp from a Mac to an Ubuntu machine arrow keys, backspace and tab completion do not work. Specifically, arrows keys and backspace result in character sequences and tab just inserts a tab. However, when using sftp from the Ubuntu machine to the Mac, I have no issues. I cannot figure out where the difference is. My goal is to be able to sftp into the Ubuntu machine and use arrow keys, backspace, and tab completion.


I have tried both zsh and bash on both machines (Upgrading from /bin/sh is the fix suggested on most other similar questions)


I have tried both Subsystem sftp /usr/lib/openssh/sftp-server and Subsystem sftp internal-sftp within the sshd_config file on the Ubuntu machine. The Mac is using /usr/libexec/sftp-server.

I realize that these settings are different so I suspect this causes the difference, but I do not know enough to understand precisely what this difference is nor how I could resolve it. I also cannot find much documentation on what these different sftp servers are.

Thank you for any advice!


with-readline is a small program that allows the GNU Readline library to be used with arbitrary programs, without having to recompile those programs. It is useful for improving the user interface of simple terminal-based programs which for whatever reason have not been modified to use Readline themselves.link

You can install with-readline to support arrow keys and backspace.
However,tab is only supported on local side, you can not complete filename from remote side.
Installation as detail below:

brew install with-readline
echo 'alias sftp="with-readline sftp"' >> ~/.zshrc
| improve this answer | |
  • Thanks for the suggestion. Any ideas for also tab completion? It works when sftping into Mac, so it ought to be possible... – user3167101 Apr 26 at 23:00
  • @user3167101It depends on how the SFTP software programmed,the official one clearly doesn't support these features. When you sftping into Mac,for instance,from windows,then actuallly you use the SFTP software programmed for windows.SFTP software has different versions,maybe you can try the third party one. – fjh1997 May 1 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.