sudo -i invalid escaping
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
sudo (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Ubuntu release: 11.04
Sudo package: 1.7.4p4-5ubuntu7.1
Current sudo version escapes commands so that they can never match anything in sudoers when using -i parameter (login shell).
What is expected (happens in 1.7.2 (ie. Ubuntu 10.04) and 1.7.5):
sudoers:
Cmnd_Alias COMMAND=/bin/bash -c /foo/bar/test.sh
command:
$ sudo -i /foo/bar/test.sh
sudo sees the command like this:
COMMAND=/bin/bash -c /foo/bar/test.sh
And the command matches the rule in sudoers and is executed.
What happens instead:
When running
$ sudo -i /foo/bar/test.sh
the command fails because it doesn't match anything in sudoers, because sudo escapes the command to this:
COMMAND=/bin/bash -c \/foo\/
and that won't match the command in sudoers because of the backslashes. It is also not possible to make similar escaping in sudoers file as you get syntax error.
I couldn't find any workaround for this, so it seems to be quite critical. The fix should probably be backported from sudo 1.7.5.
See sudo bug #451 http://