# Mount directory via sshfs a remote NFS share

## devilheart

Hello all,

we have a filer which exports some shares via NFS to a server farm. We have SSH access to the hosts of the farm, but not directly to the filer.

I'd like to mount one of these shares to a gentoo box which is not part of the farm itself.

The problem I'm facing is that I am a member of more that 16 groups and the NFS share I'm trying to mount belongs to a group which is not among the first 16 in my groups list.

When I'm logged in the farm I use tools like newgrp to overcome this limit, but how can I do this via sshfs.

The sshfs command I'm using is 

```

sshfs -o nonempty,idmap=user,workaround=rename,gid=17610 user@loginsrv:/nfs/project1 $HOME/xyz

```

and I get

```

user@loginsrv:/nfs/project1: permission denied

```

Has anyone faced a similar issue?

I also tried this solution

```

sshfs -d -o nonempty,idmap=user,workaround=rename,gid=17610,ssh_command="ssh loginsrv /home/user/setgrp" user@loginsrv:/nfs/project1 $HOME/xyz

```

but I get

```

FUSE library version: 2.9.8

nullpath_ok: 0

nopath: 0

utime_omit_ok: 0

************************************************

Use of this system by unauthorized persons or   

in an unauthorized manner is strictly prohibited

************************************************

stty: standard input: Inappropriate ioctl for device

stty: standard input: Inappropriate ioctl for device

```

and there it hangs

/home/user/setgrp is just a simple shell script which runs 

```

/usr/bin/newgrp projectg

```

----------

## petr2008

Did you tried sftp? for file copy it is enough and works inside mc.

When I need really the mount nfs over distance I use vpn and I have 

mount specified in the fstab same as in local network.

----------

## devilheart

 *petr2008 wrote:*   

> Did you tried sftp? for file copy it is enough and works inside mc.
> 
> When I need really the mount nfs over distance I use vpn and I have 
> 
> mount specified in the fstab same as in local network.

 

Hi, I'm afraid sftp is not really an option. In principle, I could use scp or rsync from the farm to copy data to the local PC.

I need a mount because I'd like to post-process locally some data which is stored in the farm.

I could ask the IT folks to enable a CIFS share of those directories and mount them locally, but I'd like to stick to sshfs because I don't have to involve other people

----------

## krinn

You know the "if the mountain will not come"...

What prevent one of your 16 groups to be gid 17610?

----------

## devilheart

 *krinn wrote:*   

> You know the "if the mountain will not come"...
> 
> What prevent one of your 16 groups to be gid 17610?

 I'm a member of more than 16 groups. The NFS share I'm trying to mount is not owned by me, but it's owned by a group whose gid is 17610. I'm a member of this group but it is not among the first 16, if I run

```
id $USER
```

after I log in to the farm

----------

## Hu

newgrp will try to run a shell as you.  This is probably not what sshfs expects.  What is printed if you set ssh_command to ssh loginsrv /bin/echo?  Does it work if you set up a wrapper that fixes the group id, then execs the requested program?

----------

## devilheart

 *Hu wrote:*   

> newgrp will try to run a shell as you.  This is probably not what sshfs expects.  What is printed if you set ssh_command to ssh loginsrv /bin/echo?
> 
> 

 

remote host has disconnected

 *Quote:*   

> Does it work if you set up a wrapper that fixes the group id, then execs the requested program?

 

I'm not sure I understand what you mean. I'm not trying to run a program. The /home/user/setgrp in the first post is just a script which runs newgrp to set my primary group to the group I'm interested in

----------

## Hu

 *devilheart wrote:*   

> remote host has disconnected

 Strange.  Please provide the full output of what you ran and how the system responded. *devilheart wrote:*   

> I'm not sure I understand what you mean. I'm not trying to run a program. The /home/user/setgrp in the first post is just a script which runs newgrp to set my primary group to the group I'm interested in

 If you aren't running a program on the remote end, what does sshfs talk to on the remote end?  newgrp will exec a child process after updating the gid.  In your case, you aren't giving one, so it will default to spawning a shell.  This is probably not what you want, and would explain the error messages you showed.

----------

## devilheart

 *Hu wrote:*   

>  *devilheart wrote:*   remote host has disconnected Strange.  Please provide the full output of what you ran and how the system responded.
> 
> 

 

```

$ sshfs -o nonempty,idmap=user,workaround=rename,gid=17610,ssh_command="ssh loginsrv /bin/echo" user@loginsrv:/nfs/project1 $HOME/xyz 

remote host has disconnected

```

 *Hu wrote:*   

>  *devilheart wrote:*   I'm not sure I understand what you mean. I'm not trying to run a program. The /home/user/setgrp in the first post is just a script which runs newgrp to set my primary group to the group I'm interested in If you aren't running a program on the remote end, what does sshfs talk to on the remote end?  newgrp will exec a child process after updating the gid.  In your case, you aren't giving one, so it will default to spawning a shell.  This is probably not what you want, and would explain the error messages you showed.

 What does sshfs normally talk to?

----------

## Hu

Whatever program it asks the peer to run.  If I read the source correctly, you can get it to print the command if you enable debug mode.  I think it runs the sftp server program.

----------

