How to browse FTP in Vifm

From Vifm Wiki
Jump to: navigation, search

Below is a tutorial on how to browse FTP servers in Vifm. It's assumed that some *nix-like operating system with support of FUSE is used. Special files described below have .ftp suffix, but it can be any other extension as well.

Install CurlFtpFS[edit]

Install it in whatever way you like the most, which probably depends on your operating system distribution. One can always obtain sources at the official site.

Configure Vifm to handle *.ftp files with CurlFtpFS[edit]

Sample command for vifmrc:

" FtpMount
filetype *.ftp
       \ {Mount with CurlFtpFS}
       \ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %CLEAR,

Let's enumerate used options of CurlFtpFS:

  • ftp_port=1 - make CurlFtpFS pick the same IP address that is already used for the control connection;
  • ,, is used to insert , literally as it has special meaning in the argument list of :filetype command (and :filextype);
  • disable_eprt - tell CurlFtpFS to disable the use of the EPRT and LPRT commands; it's there just for better connection performance.

See man curlftpfs for other options.

Create *.ftp file[edit]

Create a file with .ftp suffix for the server you're willing to connect to. Say, it's name is server-name.ftp and content is like:

-o user=<user-name> <server-address>:

The simplest example might be:

$ cat gnu.ftp
ftp.gnu.org

Connect[edit]

In a running instance of Vifm just navigate to the .ftp-file and press l or Enter key.

Alternatively, one can pass path to .ftp-file to Vifm on command-line:

vifm gnu.ftp

which will connect to remote server on Vifm's startup.

Optimization[edit]

Remote FTP servers might be slow to respond, that's why it's a good idea to ask Vifm to reduce number of file-system queries in such directories. It can be done with the following option:

set slowfs=curlftpfs

curlftpfs here is type of FUSE file-system as it's seen in mtab. So if you use fsname=NAME option of CurlFtpFS, don't forget to use that NAME in 'slowfs' option.