[lug] Passing multiword parameters through rsh from ksh

Elyse M. Grasso emgrasso at data-raptors.com
Fri Feb 23 12:41:52 MST 2007


> Just a reminder that rsh is really insecure.  It's OK if you're running
> stuff inside a cluster environment or somewhere you can really trust all
> the systems.
Yeah. I pushed for ssh, but they say they're inside a firewall and all their 
existing scripts use rsh and they want to stay consistent. 
> But anyway, both rsh and ssh invoke a shell on the _remote_ computer.
> *That* shell receives the string that you sent, which was processed by
> the local shell first.
> 
> That means, that you need *double* shell escaping and quoting, one for
> the local shell, one for the remote shell.
> 
> So maybe:
> rsh $HOST "'progname' '$note' '$@'"
> 
> Note the nesting of single quotes and double quotes.  That is untested
> but might work.
Nope. Just sticks single quotes onto the first and last things in the split.
I think I need a way to double or escape double quotes. 
> A way to test your quoting is to write a script on the remote system
> that writes out command arguments as it sees them, perhaps one per line
> using a while shift loop or for i in "$@" or something similar.  Then
> you can rsh to that script to see what you get.
The parameters are actually being fed to a perl script on the remote end. I'm 
printing out the parameters pipe-separated, and seeing waaay too many pipes 
when I use go through rsh compared to when I don't. 
> -- 
> Zan Lynx <zlynx at acm.org>
> 

-- 
Elyse Grasso

http://www.data-raptors.com    Computers and Technology
http://www.astraltrading.com   Divination and Science Fiction
http://www.data-raptors.com/global-cgi-bin/cgiwrap/emgrasso/blosxom.cgi WebLog



More information about the LUG mailing list