|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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? |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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 *** |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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? |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
Barry Margolin wrote:
> But the single quotes are inside double quotes, should it IS expanded. You are correct, my fault. Sorry for overlooking that. |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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. |
|
![]() |
| Outils de la discussion | |
|
|