Usage

Before you even start thinking about mounting FTP volumes, make sure you have a decent bandwidth or it's gonna suck.

The autofs way - A must try!

If you were wise enough to install the autofs/automount bridge (check out the installation notes) there is a cool way to use ftpfs: just try to access any file/dir on the desired server under /mnt/ftpfs.

cd /mnt/ftpfs/[user:pass@]ftp_server[:port]

Something like cd /mnt/ftpfs/ftp.kernel.org. And guess what? You're there!

Normally you will only use this for anonymous ftp since you don't want your user/pass info to show up in the /mnt/ftpfs/ tree.

The ftpmount way

ftpmount [user[:password]@]hostname[:port ][/root_dir] mount_point [-own] [-uid=id] [-gid=id] [-fmask=mask] [-dmask=mask] [-active]


The parameters: [defaults]
  • user: The user to be used for logging on the FTP server. [anonymous]
  • password: The password for that user. [user@ftpfs.sourceforge.net]
  • hostname: The FTP server.
  • port: The port the server is listening on. [21]
  • root_dir: The directory on the FTP server you want to be mounted. This should be specified without the trailing slash (that is "/home/duru", not "/home/duru/"). [/]
  • mount_point: The local directory you want to mount the FTP server onto.
  • own: Flag to force ownership on all remote files. Useful for FTP servers that list user IDs instead of user names.
  • uid: The local user ID you want to be the owner of the mounted tree.
  • gid: The local group ID you want to own the mounted tree.
  • fmask: The numeric mode to be ORed on all mounted files.
  • dmask: The numeric mode to be ORed on all mounted dirs.
  • active: Flag to enable active mode for FTP transfers. Useful if you're behind some firewall and cannot connect to random ports.

Eg: ftpmount mali@ftp.linuxnet.wox.org /mnt/ftpfs -uid=500 -gid=500 -dmask=555


It is generally a good idea not to provide your password as a parameter, since ftpmount will ask for it.

The mount way

If for some reason you choose not to use ftpmount (you probably installed the kernel patch and are too lazy to install ftpmount too), here's the way to use good-ol mount:

mount -n -t ftpfs none mount_point -o ip=server_ip [,user=user_name] [,pass=password] [,port=server_port] [,root= root_dir] [,own] [,uid=id] [,gid=id] [,fmode=mask] [,dmode=mask] [,active]

Please note that you have to provide the server's IP and that the only way to enter a password is in clear.

For example, while testing, I used the following command:

mount -n -t ftpfs none /mnt/ftpfs -o ip=127.0.0.1,user=mali,pass=my_pass

Some notes

To unmount the volume, you go like

umount mount_point

The own option (-o for ftpmount) forces ownership by the mounting user on all files. This is useful for accommodating servers with strange user/permissions management (SERVU & stuff).

A few words of wisdom:
  • Use -n mount option! I bet you don't want your user/password information listed in mtab.
  • Don't push it! (pushing it = a dozen processes reading on the mount point)
  • It works best for one process! While concurrent access (under normal circumstances) shouldn't cause any problem, the output is optimized for one process reading (the TCP connection is kept alive). So, if you're gonna watch a movie, you don't want other processes to access the mount point and kill the throughoutput (trust me!).
  • The address in IP format sucks! - Go get ftpmount.

Enjoy


Email: mali@users.sourceforge.net