plink removes quote marks

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi folks,

I'm trying to run the following command.

plink -load 'OG' -l joe.staff sudo /usr/local/sbin/disable-account
joetest --service 'dialup flat' --reason 'abuse'

The 'OG' putty config has the default values except that local echo is
forced off to hide the sudo password.  When I check the sudo log on the
server, the command is being called with the quotation marks removed.

/usr/local/sbin/disable-account joetest --service dialup flat --reason abuse

So disable-account won't run because it's expecting the --service option
argument to be quoted.

Anyone know how to fix this?


Re: plink removes quote marks

Derrin Chong wrote:
Quoted text here. Click to load it

You could try creating a temporary file with the commands in it,
suitably escaped, like:

----start tempfile.txt----
sudo /usr/local/sbin/disable-account joetest --service \"dialup flat\"
--reason \"abuse\"
----end tempfile.txt----

Then use plink's -m parameter:
plink -load 'OG' -l joe.staff -m tempfile.txt

Maybe someone else will have a better method... I doubt it's plink
stripping the quotes out, so much as it is the Windows command interpreter.

Jim Davis

Re: plink removes quote marks

Jim Davis wrote:
Quoted text here. Click to load it

Thanks for the idea.  I'll probably end up removing the whitespace from
our product id's though.

Site Timeline