Summary:Spaces in SSH traffic

From: <>
Date: Thu Apr 03 2003 - 18:29:01 EST

First thanks to the following:
Crist Clark" <>
 Tim Chipman <> 
 William Yodlowsky <>
 "Walt Sullivan" <>
Haywood, Steven" <>
Martynas Buozis <> 

and special thanks to "Crispin Harris" <> for the detailed description ( attched below). I have ended up rounding the double quotes with single quotes ('), escapeing the double quotes with \ did not help as my calling script didn't like it.
Crispin Harris reply:
The quotes are being stripped in the multiple shells.

/usr/local/bin/ssh <user> <pagerhost> /usr/local/bin/snpp -m '"Call Me"'
/usr/local/bin/ssh <user> <pagerhost> /usr/local/bin/snpp -m \"Call Me\"

This is because the local shell (in which this command is executed) sees the
command line and does this:
(single quotes (') are used to denote the start and end of the string
contained by the variables named)

ARGV[0] = '/usr/local/bin/ssh'
ARGV[1] = '<user>'
ARGV[2] = '<pagerhost>'
ARGV[3] = '/usr/local/bin/snpp'
ARGV[4] = 'Call Me'
ARGV[5] = '<pager>'

The way that ssh works is that it looks for all arguments _UP_TO_ and
_INCLUDING_ a hostname to define it's behaviour.
It then passes all the remaining arguments to the shell on the remote end
for execution.

This means that on '<pagerhost>' the a shell is executed with '<user>'
privilege with the command:
/usr/local/bin/snpp Call Me <pager>

The command probably needs to be:
/usr/local/bin/snpp "Call Me" <pager>

Somehow you need to the the double quotes through to the far end.
There are two ways to do this:
1: enclose the double quotes in single quotes:
   '"Call Me"'
  this makes ARGV[4] = '"Call Me"'
  which thus makes the remote command:
   /usr/local/bin/snpp "Call Me" <pager>

2: escape the double quotes with a backslash (\). This prevents the first
shell from interpreting the quotes.
  The arguments thus become:
   ARGV[0] = '/usr/local/bin/ssh'
   ARGV[1] = '<user>'
   ARGV[2] = '<pagerhost>'
   ARGV[3] = '/usr/local/bin/snpp'
   ARGV[4] = '"Call'
   ARGV[5] = 'Me"'
   ARGV[6] = '<pager>'
 The remote command is thus assembled like this:
   /usr/local/bin/snpp "Call Me" <pager>
 and the remote shell (and thus the perl script) do what you expect.

You want ARGV[4] to equal '"Call Me"

"Call Me" and passes it as the single variable

Crispin Harris
Systems Manager
Thin Technologies Limited
Vox: +(61) 8 9488 3000
Fax: +(61) 8 9488 3030
Mob: +(61) 413 629 298

> -----Original Message-----
> From:
> []On Behalf Of
> Sent: Thursday, April 03, 2003 2:46 PM
> To:
> Subject: OT: Spaces in SSH traffic
> Hi All,
> My appologies for asking this question here.
> We have a host which can send pager messages. Other hosts
> connect to this host via SSH to send any pager messages. We
> use perl-snpp to page. When we send page from the pager host
> no messages are sent ok (spaces between the words do not
> disappear). But when sent from the remote servers messages
> are truncated. Ex:
> /usr/local/bin/ssh <user> <pagerhost> /usr/local/bin/snpp -m
> "Call Me" <pager>
> ( user is set to go with no password)
> Message received is:
> Call (only)
> I believe this is happening in SSH tunnel. Any SSH gurus out
> there who can give me a clue. All the hosts are Solaris and
> OpenSSH (latest) version 3.51
> Thanks
> UnixAdmin
> __________________________________________________________________
> Try AOL and get 1045 hours FREE for 45 days!
> Get AOL Instant Messenger 5.1 for FREE! Download Now!
> _______________________________________________
> sunmanagers mailing list

Try AOL and get 1045 hours FREE for 45 days!

Get AOL Instant Messenger 5.1 for FREE! Download Now!
sunmanagers mailing list
Received on Thu Apr 3 18:33:34 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:08 EST