mount_afp on linux, user rights

Posted by Antonio Sesto on Server Fault See other posts from Server Fault or by Antonio Sesto
Published on 2013-02-08T15:06:59Z Indexed on 2014/06/01 3:29 UTC
Read the original article Hit count: 653

Filed under:
|
|

I need to mount a remote filesystem on a linux box using the afp protocol. The linux box runs an old Debian 4.

I downloaded the source code of mount_afp, compiled it and installed it with all the required packages.

Then created /etc/fuse with the following command:

  mknod /dev/fuse c 10 229

(according to the instructions here)

I can mount the remote filesystem as root by executing:

 mount_afp afp://USER:PASSWD@REMOTE_SERVER/FOLDER /mnt/MOUNTPOINT/

but the same command fails when run as normal user (of the local machine).

After reading here and there, I created a group fuse, and added my normal user U to the group fuse:

[prompt] groups U
U fuse

Then modified the group of /dev/fuse, that now has the following rights:

 0 crwxrwx--- 1 root fuse 10, 229 Feb  8 15:33 /dev/fuse

However, if the user U tries to mount the remote filesystem by using the same command as above, U gets the following error:

Incorrect permissions on /dev/fuse, mode of device is 20770, uid/gid is 0/1007. But your effective uid/gid is 1004/1004

But the user U with uid 1004 has also gid 1007 (group fuse).

I might think the problem is related to real/effective/etc. ID, but I do not know how to proceed and could not find any clear instructions. Could you please help me?


There is also another problem. If I mount /mnt/MOUNTPOINT as root and run ls -l /mnt, I get:

  drwxrwxrwx 15 root root 466 Feb  8 16:34 MONTPOINT

If I run ls -l /mnt as normal user U I get:

 ? ?????????? ? ? ? ?            ? MOUNTPOINT

in fact when I try to cd /mnt/MOUNTPOINT I get:

 $-> cd /mnt/MOUNTPOINT
-sh: cd: /mnt/MOUNTPOINT: Not a directory

Then I unmount /mnt/MOUNTPOINT as root and run again ls -l /mnt as normal user U I get:

 0 drwxr-xr-x 2 root root 6 Feb  8 15:32 MOUNTPOINT/

After reading Frank's answer, I killed every shell/process running with privileges of user U. Still U cannot mount the remote filesystem, but the error message has changed. Now it is: "Login error: Authentication failed". The problem is not related to remote login/password since the same command works perfectly when run as root of the local machine.


Since I cannot get mount_afp to work with normal users, I decided to follow mgorven's suggestion. So I run the commands:

 mount_afp -o allow_other afp://USER:PASSWD@REMOTE_SERVER/FOLDER /mnt/MOUNTPOINT/

and

 mount_afp -o user=U afp://USER:PASSWD@REMOTE_SERVER/FOLDER /mnt/MOUNTPOINT/

The mount succeeds but user U cannot access the mount point. If U executes ls -l in /mnt

U@LOCAL_HOST [/mnt]
$-> ls -l
ls: cannot access MOUNT_POINT: Permission denied
total 0
? ?????????? ? ? ? ?            ? MOUNT_POINT

Is it so hard to have this utility working?

© Server Fault or respective owner

Related posts about linux

Related posts about afp