[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sudo-users
Subject:    Re: [sudo-users] Quotation marks in command option.
From:       Aaron Lewis <aaron.lewis1989 () gmail ! com>
Date:       2010-08-18 14:02:40
Message-ID: 4C6BE800.5000402 () gmail ! com
[Download RAW message or body]

Bonjour Conde ,

> My problem is that sudo doesn't accept the quotation marks in the ``-c'' 
> option, it keeps asking the user for the password, and after entering it 
> gives an error that says ``Maybe you lack sudo permissions in the sudoers 
> file.''

Why not escape spaces ?

-c \"show\ storagesubsystem\ profile;\"

I did a simple test:

As your shell will handle quoted strings , so if i do like this , it
will require a credential.

* sudo /tmp/test.cmd -c "this is an arg"
Password:

So if space is also escaped , it will work.

* sudo /tmp/test.cmd -c \"this\ is\ an\ arg\"
Args: -c "this is an arg"

==================
/tmp/test.cmd

#!/usr/local/bin/bash
echo "Args: $1 $2"

==================
sudoers

Cmnd_Alias TESTCMDS = /tmp/test.cmd -c "this is an arg"
username hostname = NOPASSWD: TESTCMDS


--
Best Regards,
Aaron Lewis - PGP: 0x4A6D32A0
FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
irc: A4R0NL3WI5 on freenode

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic