MandrakeUser.Org - Your Mandrake-Linux Knowledge Base!


 
 

*DocIndex - Connectivity

Netips II

* Mounting A Remote Share Via FTP
* Accessing WebDAV Shares

Related Resources:

ftpfs Usage
WebDAV Resources

Revision / Modified: Mar. 08, 2002
Author: Tom Berger

 

* Mounting A Remote Share Via FTP

The FTP File System allows you to handle your FTP accounts on remote servers similar to shares on your local network.

Installation

The ftpfs kernel module has to be compiled from sources. If you are new to compiling, please read my primer on Compiling Source Code first. Run

make

The module should compile just fine. Now install it as 'root' with

make install

You might get an obscure error message, but this doesn't seem to have any adverse effects on the module. Run

modprobe ftpfs

to see if the module loads OK.

Switch to the 'ftpmount' directory and run another

make install

there. This will install the 'ftpmount' utility used to mount remote FTP shares to local mount directories.

Mounting

In order to mount a remote share via FTP, you need the 'ftpmount' utility and an empty local directory to which to mount the share to. 'ftpmount' has to be run by 'root'.

ftpmount account@server/share_name local_mount_directory

will - after prompting for the password for account - mount the directory share_name on server tolocal_mount_directory.
Example: account name is 'tom', server name is 'ftp.foo.net', my ftp directory on that server is '/ftp/home/tom' and the local mount directory is '/mnt/ftp':

ftpmount tom@ftp.foo.net/home/ftp/tom /mnt/ftp

Notice that there mustn't be an empty space between the server and the share name.

This will grant read permissions (e.g. ability to copy files from the remote share to the local machine) to all local users and read/write permissions to 'root'.
In order to allow a local user to write to the remote share, you have to supply their User ID (UID). To find out the UID of a user, you can use this command:

grep user_name /etc/passwd | cut -d ":" -f 3

Assuming the UID for the example user 'tom' is '501', the ftpmount command would look like this:

ftpmount tom@ftp.foo.net/home/ftp/tom /mnt/ftp -uid=501

Now local user 'tom' is owner of the mounted tree and can write (move or copy files to the remote share, delete files on the remote share etc) to it.

To unmount the share, 'root' uses:

umount local_mount_directory

In this example:

umount /mnt/ftp

Check out the files in the 'docs' directory of the source archive to learn about other options of the 'ftpmount' command and advanced capabilities of 'ftpfs'.

* section index * top

* Accessing WebDAV Shares

WebDAV, the 'Web Distributed Authoring and Versioning Filesystem', "is a set of extensions to the HTTP protocol which allows users to collaboratively edit and manage files on remote web servers." It is an open standard and supported by MS Windows, Mac OS X and Linux.
It is superior to FTP in that it allows for strong encryption, proxy support, multiple transfers per connection and is less of an security nightmare FTP undoubtedly is.

The most prominent provider of WebDAV shares so far is Apple. If you are a registered Apple user, you can get an account on Apple's servers, the so-called 'iDisk'.

In order to access your WebDAV share from Linux, you have two possibilities: either you use an ftp-like command line client, or you mount that share to your local machine.

The first method only takes two steps:

  1. Installing the cadaver WebDAV client from your Mandrake Linux CD:

    urpmi cadaver

  2. Connecting to WebDAV server and share

    cadaver http://server/share

    In case of the iDisk, the server name is 'idisk.mac.com' and the share name is your iTools user name. You will be prompted for your user name and password and then connected.

Type help on the 'cadaver' prompt to get a list of available commands. If you've ever used a command line FTP client like 'lftp' or 'ncftp', you will feel right at home.

The second method, mounting the remote WebDAV share to the local system, is a bit more involved. You have to download and compile the davfs kernel module. If you are new to compiling source code, please read my primer on Compiling Source Code first.

Currently, the latest version of davfs is 0.2.4. If you are compiling this module on an 8.1 or older Mandrake Linux release, you have to make a small change to one of the source files in order to get the module to compile.

  1. Open 'davfs/inode.c' in an editor and go to line 620 (it's at the end of the file).

  2. Put a hash ('#') sign in front of these lines:
    MODULE_AUTHOR("Sung Kim <hunkim@cs.ucsc.edu>");
    MODULE_DESCRIPTION("Web Distributed Authoring and Versioning Filesystem");
    MODULE_LICENSE("GPL");

    and save the file.

Run configure, make and make install (as 'root') to compile and install the module. If you want SSL support in davfs, run configure like this

./configure --with-ssl=/usr

make sure you have the 'libopenssl0-devel' package installed, then.

To make things a bit easier now, set up a symbolic link from '/usr/local/sbin/mount.davfs' to '/usr/sbin/davmount' as 'root':

ln -s /usr/local/sbin/mount.davfs /usr/sbin/davmount

Now you're almost there. All you need is an empty local directory to mount the WebDAV share to. How about '/mnt/dav'? As 'root':

mkdir /mnt/dav

Now mount the share (as 'root'):

davmount http://server/share/ /mnt/dav

Notice that the share name has to have a trailing slash.
You will be prompted for your user name and password, then the share will be mounted. Use 'ls' or your favorite file manager to browse it via '/mnt/dav'.

In order to unmount the share, run (as 'root')

umount /mnt/dav

In this standard setting, all users have read-only access to the mounted share, only 'root' has read/write access. In order to grant a user or a group of users write access to the share, you can use the '-U' or '-G' options. To grant local user 'tom' write access to the share:

davmount http://server/share/ /mnt/dav -Utom

Notice that the documentation included in the davfs archive ('doc/HOWTO.txt') should be taken with a grain of salt. I found it rather confusing if not dangerous. Especially do not provide your password via the '-p' option to the 'davmount' command! If you do this, everyone with access to your process table (i.e. every local user) will be able to read it.

(Special thanks to Phil Lavigna, whose article about WebDAV on MandrakeForum was a great inspiration for this article.)

* section index * top

 
Legal: All texts on this site are covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB (Tom Berger) and Mandrakesoft 1999-2002.