PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > rsh to host and run command as another user
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

rsh to host and run command as another user

Réponse
 
LinkBack Outils de la discussion
Vieux 09/01/2008, 22h10   #1
littlehelphere@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut rsh to host and run command as another user

I have a script, in which I rsh to a host and run a command based on a
variable. However, I am having issues with this portion of the
script. Would appreciate any ideas.


example
FOOHOME=/usr/local/foo/
I want to rsh to machine b from machine a and run a command as user
foo

from machine a
#rsh -n machineb "su - foo - c '$FOOHOME/bin/command'"

The above does not work and I am wondering how to get this to run.
  Réponse avec citation
Vieux 09/01/2008, 22h19   #2
littlehelphere@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: rsh to host and run command as another user

On Jan 9, 5:29 pm, pk <p...@pk.pk> wrote:
> littleh...@gmail.com wrote:
> > I have a script, in which I rsh to a host and run a command based on a
> > variable. However, I am having issues with this portion of the
> > script. Would appreciate any ideas.

>
> > example
> > FOOHOME=/usr/local/foo/
> > I want to rsh to machine b from machine a and run a command as user
> > foo

>
> > from machine a
> > #rsh -n machineb "su - foo - c '$FOOHOME/bin/command'"

>
> Can't you just use "-l foo" in the rsh command line?


I need to use a .rsh for this and I would prefer not to for security.
Also, this still wont allow me to expand the variable $FOOHOME
  Réponse avec citation
Vieux 09/01/2008, 22h29   #3
pk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: rsh to host and run command as another user

littlehere@gmail.com wrote:

> I have a script, in which I rsh to a host and run a command based on a
> variable. However, I am having issues with this portion of the
> script. Would appreciate any ideas.
>
>
> example
> FOOHOME=/usr/local/foo/
> I want to rsh to machine b from machine a and run a command as user
> foo
>
> from machine a
> #rsh -n machineb "su - foo - c '$FOOHOME/bin/command'"


Can't you just use "-l foo" in the rsh command line?

  Réponse avec citation
Vieux 09/01/2008, 22h37   #4
pk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: rsh to host and run command as another user

littlehere@gmail.com wrote:

>> > from machine a
>> > #rsh -n machineb "su - foo - c '$FOOHOME/bin/command'"

>>
>> Can't you just use "-l foo" in the rsh command line?

>
> I need to use a .rsh for this and I would prefer not to for security.
> Also, this still wont allow me to expand the variable $FOOHOME


Ah ok, so /that/ the problem was (it was not clear from your first post).
Well, you put the variable inside single quotes, so it's not expanded.

  Réponse avec citation
Vieux 09/01/2008, 22h46   #5
Barry Margolin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: rsh to host and run command as another user

In article <fm3hbu$m49$1@aioe.org>, pk <pk@pk.pk> wrote:

> littlehere@gmail.com wrote:
>
> >> > from machine a
> >> > #rsh -n machineb "su - foo - c '$FOOHOME/bin/command'"
> >>
> >> Can't you just use "-l foo" in the rsh command line?

> >
> > I need to use a .rsh for this and I would prefer not to for security.


So you want to be asked for their password?

Although there's an rexecd server that implements this (executing a
command line using password authentication rather than .rhosts), I don't
think most Unix systems provide a command like rsh that connects to it.

Can you use ssh rather than rsh? That will allow you to do this, and it
doesn't send the password over the network.

> > Also, this still wont allow me to expand the variable $FOOHOME

>
> Ah ok, so /that/ the problem was (it was not clear from your first post).
> Well, you put the variable inside single quotes, so it's not expanded.


But the single quotes are inside double quotes, should it IS expanded.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
  Réponse avec citation
Vieux 09/01/2008, 23h57   #6
littlehelphere@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: rsh to host and run command as another user

On Jan 9, 5:46 pm, Barry Margolin <bar...@alum.mit.edu> wrote:
> In article <fm3hbu$m4...@aioe.org>, pk <p...@pk.pk> wrote:
> > littleh...@gmail.com wrote:

>
> > >> > from machine a
> > >> > #rsh -n machineb "su - foo - c '$FOOHOME/bin/command'"

>
> > >> Can't you just use "-l foo" in the rsh command line?

>
> > > I need to use a .rsh for this and I would prefer not to for security.

>
> So you want to be asked for their password?
>
> Although there's an rexecd server that implements this (executing a
> command line using password authentication rather than .rhosts), I don't
> think most Unix systems provide a command like rsh that connects to it.
>
> Can you use ssh rather than rsh? That will allow you to do this, and it
> doesn't send the password over the network.
>
> > > Also, this still wont allow me to expand the variable $FOOHOME

>
> > Ah ok, so /that/ the problem was (it was not clear from your first post).
> > Well, you put the variable inside single quotes, so it's not expanded.

>
> But the single quotes are inside double quotes, should it IS expanded.
>
> --
> Barry Margolin, bar...@alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***
> *** PLEASE don't copy me on replies, I'll read them in the group ***


so for ssh I would need to put the pub key in place, right? Anything
else? Beyond the single quotes is the remainder of the command OK?
  Réponse avec citation
Vieux 10/01/2008, 08h43   #7
pk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: rsh to host and run command as another user

Barry Margolin wrote:

> But the single quotes are inside double quotes, should it IS expanded.


You are correct, my fault. Sorry for overlooking that.


  Réponse avec citation
Vieux 10/01/2008, 08h46   #8
pk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: rsh to host and run command as another user

littlehere@gmail.com wrote:

> so for ssh I would need to put the pub key in place, right? Anything
> else? Beyond the single quotes is the remainder of the command OK?


The single quotes are not a problem, as Barry correctly pointed out. With
ssh, and the appropriate keys in place, you could just do

ssh foo@machineb $FOOHOME/bin/command

and you should be OK.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h03.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12325 seconds with 16 queries