2

I am currently developping an application for the purpose of which I need to retrieve some files from a remote location, that I can only access through ssh. Since I need to automount that repo, I tried to set up an autofs about it (can't put it in fstab since fstab does not mount it back after network failures).

Unfortunaltely, I encountered some problem configuring it. Despite my search, I was not able to find any clue about my problem... so here I am.

Basicely I am trying to do automatically what I used to do that way:

sshfs myuser@xxx.yy.zz.oo: /mnt/mylocalrepo -o allow_other 

I need this for a tomcat user whose pid is 502. In order to do that, here's my auto.master:

# $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $ 
/misc   /etc/auto.misc
/net    -hosts
/mnt    /etc/auto.sshfs --timeout=30, --ghost,  --debug

and my auto.sshfs:

mylocalrepo -fstype=fuse,uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,ro,allow_other :sshfs\#monuser@xxx.yy.zz.oo\:

I also set the output level to 'debug' in /etc/sysconfg/autofs.

Then, /etc/init.d/autofs restart.

Unfortunately, nothing happens.... The logs say :

Dec 19 11:52:03 something automount[17018]: handle_packet: type = 3
Dec 19 11:52:03 something automount[17018]: handle_packet_missing_indirect: token 279, name mylocalrepo, request pid 18480
Dec 19 11:52:03 something automount[17018]: attempting to mount entry /mnt/mylocalrepo
Dec 19 11:52:03 something automount[17018]: lookup_mount: lookup(file): looking up mylocalrepo
Dec 19 11:52:03 something automount[17018]: lookup_mount: lookup(file): mylocalrepo -> -fstype=fuse,uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other :sshfs\#myuser@xxx.yy.zz.oo\:
Dec 19 11:52:03 something automount[17018]: parse_mount: parse(sun): expanded entry: -fstype=fuse,uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other :sshfs\#myuser@xxx.yy.zz.oo\:
Dec 19 11:52:03 something automount[17018]: parse_mount: parse(sun): gathered options: fstype=fuse,uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other
Dec 19 11:52:03 something automount[17018]: parse_mount: parse(sun): dequote(":sshfs\#myuser@xxx.yy.zz.oo\:") -> :sshfs#myuser@xxx.yy.zz.oo:
Dec 19 11:52:03 something automount[17018]: parse_mount: parse(sun): core of entry: options=fstype=fuse,uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other, loc=:sshfs#myuser@xxx.yy.zz.oo:
Dec 19 11:52:03 something automount[17018]: sun_mount: parse(sun): mounting root /mnt, mountpoint mylocalrepo, what sshfs#myuser@xxx.yy.zz.oo:, fstype fuse, options uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other
Dec 19 11:52:03 something automount[17018]: do_mount: sshfs#myuser@xxx.yy.zz.oo: /mnt/mylocalrepo type fuse options uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other using module generic
Dec 19 11:52:03 something automount[17018]: mount_mount: mount(generic): calling mkdir_path /mnt/mylocalrepo
Dec 19 11:52:03 something automount[17018]: mount_mount: mount(generic): calling mount -t fuse -s -o uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other sshfs#myuser@xxx.yy.zz.oo: /mnt/mylocalrepo

The repo is in /mnt/ :

dr-xr-xr-x 2 root root 0 déc 19 11:51 mylocalrepo

But when I try to access it, through the root user, or through the tomcat-user, after a few minutes of freeze, I get this in logs:

Dec 19 12:16:34 something automount[17018]: mount(generic): failed to mount sshfs#myuser@xxx.yy.zz.oo: (type fuse) on /mnt/mylocalrepo
Dec 19 12:16:34 something automount[17018]: dev_ioctl_send_fail: token = 280
Dec 19 12:16:34 something automount[17018]: failed to mount /mnt/mylocalrepo
Dec 19 12:16:34 something automount[17018]: handle_packet: type = 3
Dec 19 12:16:34 something automount[17018]: handle_packet_missing_indirect: token 281, name mylocalrepo, request pid 18480
Dec 19 12:16:34 something automount[17018]: attempting to mount entry /mnt/mylocalrepo
Dec 19 12:16:34 something automount[17018]: lookup_mount: lookup(file): looking up mylocalrepo
Dec 19 12:16:34 something automount[17018]: dev_ioctl_send_fail: token = 281
Dec 19 12:16:34 something automount[17018]: failed to mount /mnt/mylocalrepo

So if any of you have any idea or tip about my problem or how to find more clues about it, they are indeed welcome!

Thanks in advance.

My settings :

autofs-5.0.1-0.rc2.143.el5_5.6 kernel 2.6.18-194.32.1.el5 CentOS release 5.5 (Final)

PS : this post is a nearly exact copy of one I posted on stack overflow... but it looked like it was not the place to ask it. So hope this place will be. If it is still not, please take time to explain why.

Marvin
  • 121

1 Answers1

1

autofs tries to perform the mount as the root user. To test if your setup can work, log in as root (su -) and try the mount line from your autofs start log:

`mount -t fuse -s -o uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other sshfs#myuser@xxx.yy.zz.oo: /mnt/mylocalrepo`

Since autofs does exactly that (it calls mount with the arguments listed, as the root user), it should fail and give you more decent debug output. Typically, I find that permission problems for the identity file are to blame.

nc4pk
  • 9,257
  • 14
  • 61
  • 71