I ssh'd into a remote server from shell and tried to open a file on a directory path that also exists on my local system. The list of files I was able to open using helm-find-files was the list on my local machine, and not on the ssh'd system. How can I configure Emacs to be smart enough to provide me the list of files on the path for the remote server?

1 Answer 1


For that, you use Tramp. Don't ssh directly through you shell. Otherwise Emacs won't see it. To use Tramp in both stock Emacs and helm-find-files, use this syntax in the find file prompt:

/<connect method>:username@host#port:<path>

For example, if you want to ssh to wdkrnls at port 2222 to your home directory, then write it like this:

/ssh:[email protected]#2222:/home/wdkrnls

You may omit the connect method if you set tramp-default-method to ssh:

(setq tramp-default-method "ssh")

Then, you can simply write this to ssh to your remote host:

/[email protected]#2222:/home/wdkrnls

Absolute path is required in helm-find-files for it to offer completion candidates, so you should open a Dired buffer at your home directory to make it an anchor.

If you add your host to ~/.ssh/config like this:

Host host1
     User wdkrnls
     Port 2222

Then, you no more need to specify the username and port. When you type /ssh: in your helm-find-files prompt, a list of hosts in your ~/.ssh/config are given to you to select. You only simply write /ssh:host1: and wait for Tramp to connect. Successfully connected, you will start browsing remote file system like your local one.

Since you also set tramp-default-method to ssh, you can simply write like this to connect to remote host:

  • I was hoping for a way to make Emacs "see it". I have been using the tramp method (albeit more verbosely than necessary).
    – wdkrnls
    Jan 9, 2015 at 21:23
  • Another issue I have is Emacs doesn't give me correct bash completions through ssh in shell mode. I'm hoping the two problems are intertwined and someone somewhere has managed to solve both of them.
    – wdkrnls
    Jan 9, 2015 at 21:25
  • Well if you want such ssh completion, user ansi-term for a real terminal emulator. Otherwise, I don't think there is a way except using Tramp syntax in Eshell.
    – Tu Do
    Jan 9, 2015 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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