experiences with openssh automation

Taavi Burns jaaaarel-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Tue Aug 9 13:55:56 UTC 2005


On 8/8/05, Mike Kallies <mgjk-cpI+UMyWUv9BDgjK7y7TUQ at public.gmane.org> wrote:
> For example, automation which requires auditing /etc/shadow (hey, it does
> happen!) begins to require scripts with statements like:
> 
> ssh -q -o MatchMode=yes server sudo su root -c \"grep \\\"expression\\\"
> /etc/shadow\"
> 
> v.s.
> 
> rsh server grep \"expression\" /etc/shadow

You could not use quotes around the outside and escape the spaces:
ssh -q -o MatchMode=yes server sudo su root -c grep\ \"expression\"\ /etc/shadow
Or you could use different kinds of quotes (if you only need to nest 2 levels):
ssh -q -o MatchMode=yes server sudo su root -c 'grep "expression" /etc/shadow'
ssh -q -o MatchMode=yes server sudo su root -c "grep 'expression' /etc/shadow"

Note that these last two have different meanings.  If you have any
$ENVVARs, the former will use what is defined on the remote host, and
the latter will use what is defined on the local host (hint: read up
on the different kinds of quotes and what they do).

-- 
taa
/*eof*/
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list