ssh and change group id



I am trying to ssh to a remote host but execute as a different group id on
that host.

We have multiple group id's at our site. Everyone's default group id is
user. Then for specific needs, we have group ids with limited users in
them. I have a process than I trying to run on a remote machine at a
specific group id. For instance, I would like to do the following

ssh myname@myhost myprog --display mydisplay:0 --myparam 5

But I want the program to run with mygroup as the group id and not the
user group.

I have tried

ssh myname@myhost sg mygroup -c myprog --display mydisplay:0 -myparam 5
ssh myname@myhost "sg mygroup -c myprog --display mydisplay:0 -myparam 5"
ssh myname@myhost sg mygroup -c "myprog --display mydisplay:0 -myparam 5"
ssh myname@myhost sg mygroup -c 'myprog --display mydisplay:0 -myparam 5'

And other combinations. (It also doesn't work for rsh). I lose the command
line parameters for myprog.

I tested this with a simple script (myprog)

#!/bin/sh

echo `id`
echo $1
echo $2
echo $3
echo $4

sleep 5

I also used the chmod 2770 to set the sticky bit on group but the problem
here is that linux security unset's LD_LIBRARY_PATH and so the libraries
can't be found. I know I can use ld.so.conf.d to define the paths but we
are developing the program and the developers are on different versions on
the libraries so we use LD_LIBRARY_PATH to define the work area the user
is using.

If I issue the sg command locally (no ssh), then the parameters do get
passed to the script

sg mygroup -c "myprog --display mydisplay:0 --myparam 5"


Somewhere between ssh and sg, the command line parameters for my program
is getting lost.



Relevant Pages

  • Re: sshd and ftpd
    ... ssh keys, so when you log in it doesn't ask for one. ... we want to be able to connect to our remote host without ... If you used the defaults supplied by the ssh-keygen command, ...
    (Ubuntu)
  • Re: unattended file transfer with ssh
    ... disadvantage to using rsync and can't come up with one:) ... To set up ssh, ... $HOME/.ssh/authorized_keys on the remote host. ... On the local machine invoke this command: ...
    (comp.security.ssh)
  • Re: unattended file transfer with ssh
    ... Then I pipe them to cpio, ... It uses ssh. ... $HOME/.ssh/authorized_keys on the remote host. ... On the local machine invoke this command: ...
    (comp.security.ssh)
  • Re: using ssh to run remote commands? [ssh -T, scp/ssh flags]
    ... I use SSH to forward connections between an intranet server at home and my ... To do this, the user on the remote machine need not have a shell, either ... start a shell on the remote host, ... you can have ssh run a command instead of an interactive shell by ...
    (FreeBSD-Security)
  • SUMMARY: ufsdump via ssh issues
    ... something preventing me from executing a command on the remote server. ... OpenSSH_2.9.9p2, SSH protocols 1.5/2.0, OpenSSL 0x0090602f ... But when i run the following, the remote host closes the connection, I ... DUMP: Date of last level 0 dump: the epoch ...
    (SunManagers)