sshfs to a machine but ls fail with Permission denied

This is a discussion on sshfs to a machine but ls fail with Permission denied within the SSH forums, part of the Protocols category; I can ssh to a machine as a non-root user and run the "ls" command. I can sshfs to the same machine as a non-root user but "ls" fail with ...

Go Back   Unix Linux Forum > Technologies & Tools > Protocols > SSH

FixUnix.com - Unix Linux Forums

Unix Content Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-13-2008, 10:14 AM
Default sshfs to a machine but ls fail with Permission denied

I can ssh to a machine as a non-root user and run the "ls" command.
I can sshfs to the same machine as a non-root user but "ls" fail with
"Permission denied".
Please help to fix this problem.

twong@local$ sudo sshfs -o idmap=user remote: /home/twong/remote
root@remote's password:
;sshfs successfully.

twong@local$ ls -l /home/twong/remote
ls: /home/twong/remote: Permission denied

root@local#ls -l /home/twong/remote
;...
files in the /root directory of remote can be listed correctly by root
at local.

twong@local$ sudo sshfs -o idmap=user remote:/home/twong /home/twong/
remote
root@remote's password:
twong@local$ ls -l /home/twong/remote
ls: /home/twong/remote: Permission denied

root@local#ls -l /home/twong/remote
;...
drwxrwxr-x 1 505 505 4096 Apr 24 17:39 bin
files in the /home/twong directory of remote can be listed by root at
local but the id is not twong.

local machine OS is FC6.
remote OS is RH7.2.

Reply With Quote
  #2  
Old 08-15-2008, 10:38 AM
Default Re: sshfs to a machine but ls fail with Permission denied

On Aug 13, 10:14*am, TsanChung wrote:
> I can ssh to a machine as a non-root user and run the "ls" command.
> I can sshfs to the same machine as a non-root user but "ls" fail with
> "Permission denied".
> Please help to fix this problem.
>
> twong@local$ sudo sshfs -o idmap=user remote: /home/twong/remote
> root@remote's password:
> ;sshfs successfully.
>
> twong@local$ ls -l /home/twong/remote
> ls: /home/twong/remote: Permission denied
>
> root@local#ls -l /home/twong/remote
> ;...
> files in the /root directory of remote can be listed correctly by root
> at local.
>
> twong@local$ sudo sshfs -o idmap=user remote:/home/twong /home/twong/
> remote
> root@remote's password:
> twong@local$ ls -l /home/twong/remote
> ls: /home/twong/remote: Permission denied
>
> root@local#ls -l /home/twong/remote
> ;...
> drwxrwxr-x 1 505 505 * * 4096 Apr 24 17:39 bin
> files in the /home/twong directory of remote can be listed by root at
> local but the id is not twong.
>
> local machine OS is FC6.
> remote OS is RH7.2.


Problem is solved as follows.
twong@local$ id twong
uid=500(twong) gid=500(twong) groups=500(twong),101(fuse)

twong@local$ sudo sshfs -o idmap=user -o uid=500 -o gid=500 -o
allow_other twong@thorin: /home/twong/thorin


Reply With Quote
  #3  
Old 08-15-2008, 11:13 AM
Default Re: sshfs to a machine but ls fail with Permission denied

TsanChung wrote:
> twong@local$ sudo sshfs -o idmap=user -o uid=500 -o gid=500 -o
> allow_other twong@thorin: /home/twong/thorin


Why were you running sshfs within sudo in the first place? Assuming
this is the FUSE-based sshfs and not some other sshfs, the intended
usage is that you run it as the ordinary user, and it calls the
setuid fusermount program to mount the filesystem.
--
Simon Tatham "The distinction between the enlightened and the
terminally confused is only apparent to the latter."
Reply With Quote
  #4  
Old 08-15-2008, 12:12 PM
Default Re: sshfs to a machine but ls fail with Permission denied

On Aug 15, 11:13*am, Simon Tatham wrote:
> TsanChung * wrote:
> > twong@local$ sudo sshfs -o idmap=user -o uid=500 -o gid=500 -o
> > allow_other twong@thorin: /home/twong/thorin

>
> Why were you running sshfs within sudo in the first place? Assuming
> this is the FUSE-based sshfs and not some other sshfs, the intended
> usage is that you run it as the ordinary user, and it calls the
> setuid fusermount program to mount the filesystem.
> --
> Simon Tatham * * * * "The distinction between the enlightened andthe
> * *terminally confused is only apparent to the latter."


If I do not use sudo, then it will fail.
$ sshfs -o idmap=user -o uid=500 -o gid=500 -o allow_other
twong@remote: /home/twong/remote
twong@remote's password:
fuse: failed to exec fusermount: Permission denied

$ sshfs -V
SSHFS version 1.7
FUSE library version: 2.6.3
using FUSE kernel interface version 7.8


Reply With Quote
  #5  
Old 08-15-2008, 01:53 PM
Default Re: sshfs to a machine but ls fail with Permission denied

TsanChung wrote:
> If I do not use sudo, then it will fail.

[...]
> fuse: failed to exec fusermount: Permission denied


So check the permissions on fusermount. But fixing that problem is
the _right_ answer; any trickery with sudo is a workaround at best.
--
Simon Tatham "What a caterpillar calls the end of the
world, a human calls a butterfly."
Reply With Quote
  #6  
Old 08-15-2008, 05:33 PM
Default Re: sshfs to a machine but ls fail with Permission denied

On Aug 15, 1:53*pm, Simon Tatham wrote:
> TsanChung * wrote:
> > If I do not use sudo, then it will fail.

> [...]
> > fuse: failed to exec fusermount: Permission denied

>
> So check the permissions on fusermount. But fixing that problem is
> the _right_ answer; any trickery with sudo is a workaround at best.
> --
> Simon Tatham * * * * "What a caterpillar calls the end of the
> * *world, a human calls a butterfly."


You are right. I do not need sudo.
I need to logout completely in order that sshfs will work properly.
Reply With Quote
  #7  
Old 08-15-2008, 05:33 PM
Default Re: sshfs to a machine but ls fail with Permission denied

On Aug 15, 1:53*pm, Simon Tatham wrote:
> TsanChung * wrote:
> > If I do not use sudo, then it will fail.

> [...]
> > fuse: failed to exec fusermount: Permission denied

>
> So check the permissions on fusermount. But fixing that problem is
> the _right_ answer; any trickery with sudo is a workaround at best.
> --
> Simon Tatham * * * * "What a caterpillar calls the end of the
> * *world, a human calls a butterfly."


You are right. I do not need sudo.
I need to logout completely in order that sshfs will work properly.
Reply With Quote
Reply

Thread Tools


All times are GMT -5. The time now is 10:20 AM.

In an effort to better serve ads to our visitors, cookies are used on Fixunix.com. For more information, check out our Privacy Policy.

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Ad Management by RedTyger