sshfs to a machine but ls fail with Permission denied - SSH

This is a discussion on sshfs to a machine but ls fail with Permission denied - SSH ; 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 ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: sshfs to a machine but ls fail with Permission denied

  1. 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.


  2. 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



  3. 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."

  4. 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



  5. 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."

  6. 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.

  7. 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 to Thread