You are not logged in.

#1 2008-05-20 19:14:28

nchase
Member
Registered: 2008-05-20
Posts: 9

sshfs and rc.local

I'm trying to mount an sshfs share when arch boots using the rc.local file.

So far, my efforts have failed -- the drive will not mount in rc.local, but it mounts just fine when I run the same command after logging in.

I thought at first that it might be my rc.local file that wasn't being read correctly or had incorrect permissions, but I added an extra line that touches a new file in my home directory, and that works just fine.

Any ideas on what I might be doing wrong?

Offline

#2 2008-05-20 19:44:24

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: sshfs and rc.local

Can't you use fstab?

Offline

#3 2008-05-20 19:45:25

Ambi
Member
From: Warsaw, Poland
Registered: 2007-11-29
Posts: 44

Re: sshfs and rc.local

You have to mount it as the user whose public key is accepted by ssh server. rc.local file is mounted by root. Did you try to mount sshfs as root? Paste your rc.local file plz and try to enter the same command after booting.

You may be interested in my rc.local file:

sudo -u ambi mount /mnt/gamma

and fstab entry:

sshfs#stankowskip@gamma.mini.pw.edu.pl: /mnt/gamma fuse comment=sshfs,noauto,users,uid=1000,reconnect,transform_symlinks,BatchMode=yes

Ambi's uid is 1000. I have turned automouting off because root cannot log to my ssh server.
More info about sshfs in fstab: http://ubuntuforums.org/showthread.php?t=430312

And the simpler way (without fstab) is to enter in rc.conf:

sudo -u ambi stankowskip@gamma.mini.pw.edu.pl: /mnt/gamma

Last edited by Ambi (2008-05-20 19:48:21)

Offline

#4 2008-05-20 20:05:12

nchase
Member
Registered: 2008-05-20
Posts: 9

Re: sshfs and rc.local

lucke: I tried fstab with the following entry and it did not mount. Then, after logged in, I ran command "sudo mount -a" and the drive mounted roll

sshfs#user@server.org:/media/raid0 /media/netdrive1 fuse defaults 0 0
Ambi wrote:

You have to mount it as the user whose public key is accepted by ssh server. rc.local file is mounted by root. Did you try to mount sshfs as root? Paste your rc.local file plz and try to enter the same command after booting.

You may be interested in my rc.local file:

sudo -u ambi mount /mnt/gamma

and fstab entry:

sshfs#stankowskip@gamma.mini.pw.edu.pl: /mnt/gamma fuse comment=sshfs,noauto,users,uid=1000,reconnect,transform_symlinks,BatchMode=yes

Ambi's uid is 1000. I have turned automouting off because root cannot log to my ssh server.
More info about sshfs in fstab: http://ubuntuforums.org/showthread.php?t=430312

And the simpler way (without fstab) is to enter in rc.conf:

sudo -u ambi stankowskip@gamma.mini.pw.edu.pl: /mnt/gamma

I think the entry in my rc.local file accounts for the need to mount as the correct user, but I may be wrong. Here is my rc.local file:

su - noah -c "sshfs nchase.homelinux.org:/media/raid0 /media/netdrive1"

I will try using your fstab and rc.local file to see what I can come up with.

edit: my rc.local file and fstab entry are pretty much the same as yours now, I think, and I am still not getting results. Here they are in full:

sudo -u noah mount /media/netdrive1

sshfs#noah@nchase.homelinux.org:/media/raid0 /media/netdrive1 fuse comment=sshfs,noauto,users,uid=1000,reconnect,transform_symlinks,BatchMode=yes

Do I need to add a module or daemon to /etc/rc.conf to get this to work on startup?

Last edited by nchase (2008-05-20 20:15:58)

Offline

#5 2008-05-20 20:27:13

Ambi
Member
From: Warsaw, Poland
Registered: 2007-11-29
Posts: 44

Re: sshfs and rc.local

not sure, there is fuse module in my rc.conf.
Try to execute "sudo -u noah mount /media/netdrive1" as root and paste the output.

Offline

#6 2008-05-20 20:27:35

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: sshfs and rc.local

If you put auto in the 4th column of fstab, it should mount on boot.

Offline

#7 2008-05-20 20:31:42

nchase
Member
Registered: 2008-05-20
Posts: 9

Re: sshfs and rc.local

Ambi wrote:

not sure, there is fuse module in my rc.conf.
Try to execute "sudo -u noah mount /media/netdrive1" as root and paste the output.

fusermount: failed to open current directory: permission denied

yikes


I think I assumed this was working before, because I had used the 'su' command to change to root.

Does this mean my permissions are not properly set up?  What now?

Last edited by nchase (2008-05-20 20:35:28)

Offline

#8 2008-05-20 20:34:20

nchase
Member
Registered: 2008-05-20
Posts: 9

Re: sshfs and rc.local

lucke wrote:

If you put auto in the 4th column of fstab, it should mount on boot.

changed noauto to auto -- didn't work

Offline

#9 2008-05-20 20:45:53

nchase
Member
Registered: 2008-05-20
Posts: 9

Re: sshfs and rc.local

the permissions for the netdrive1 directory, could they be any more open? here is the output of 'ls':

drwxrwxrwx  2 root root 4096 2008-05-18 22:04 netdrive1

Offline

#10 2008-05-22 20:28:20

nchase
Member
Registered: 2008-05-20
Posts: 9

Re: sshfs and rc.local

I used a hack to fix this. If I add a 'modprobe fuse' line before I mount the share in rc.local, it works.

Offline

#11 2008-05-22 23:16:58

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: sshfs and rc.local

nchase wrote:

I used a hack to fix this. If I add a 'modprobe fuse' line before I mount the share in rc.local, it works.

That's what MODULES field in /etc/rc.conf is for - just add 'fuse' there, and you don't have to do any extra modprobbing in rc.local.

Offline

#12 2008-05-22 23:18:26

nchase
Member
Registered: 2008-05-20
Posts: 9

Re: sshfs and rc.local

bender02 wrote:
nchase wrote:

I used a hack to fix this. If I add a 'modprobe fuse' line before I mount the share in rc.local, it works.

That's what MODULES field in /etc/rc.conf is for - just add 'fuse' there, and you don't have to do any extra modprobbing in rc.local.

I know, but it was there before and it didn't work. For some reason it works this way, but not as part of the module list in rc.conf.

Last edited by nchase (2008-05-22 23:18:56)

Offline

Board footer

Powered by FluxBB