1

I can't figure out the correct syntax for a link to a password-protected FTP site. I want to insert a link in org-mode, which opens a remote FTP server at a given directory in dired.

When I try

/user:pass@host:/dir

I get the error unknown method user.

When I do

/ftp:user:pass@host:/dir

I get prompted for a Password for myusername@user

Finally, when I do

ftp://user:pass@host:/dir

the link gets opened externally (in Firefox)

  • An alternative solution could be to store the password in ~/.authinfo, as described in the Password handling section of the TRAMP manual. The password would then be available at any link to that server, not just in the specific org file. – legoscia Jan 13 '15 at 17:04
2

As @legoscia mentions, one solution is to store the username and password in an external file. This is necessary because TRAMP's file syntax does not support specifying the password inline. If you really are using the ftp protocol, then you can use the ~/.netrc file, with basic syntax:

machine HOST login USER password PASS

described in more detail here. One detail is that it is important to set the permissions on the ~/.netrc file to not be world readable (e.g., chmod o-r ~/.netrc), otherwise emacs will refuse to use it.

For instance, with the following line in your ~/.netrc

machine ftp.gnu.org login anonymous password my.email@whatever.org

you can use a link such as [[file:/ftp:ftp.gnu.org:/gnu/emacs/]], which would take you to a dired buffer of the emacs source tarballs.

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.