matching a newline ctrl-j

Fabrice Gonton fabrice.gonton at creditlyonnais.fr
Fri Dec 13 05:55:22 EST 2002


Hi,

For some reasons, I need to run some commands as
root and need to take root environment before running
those commands (most of them require arguments I am
unaware of).

Let's take an example with the "who" command

/etc/sudoers:

[...]
bob   zeus: NOPASSWD: /usr/bin/su - root -c /usr/bin/who,/usr/bin/su - root
-c /usr/bin/who *,!/usr/bin/su - root -c /usr/bin/who *[;|^`&$><]*
[...]


Bob can use 'who' with or without arguments but he cannot add any
command by trying something like :

sudo /usr/bin/su -root "/usr/bin/who;id"

My problem is that I don't know how to avoid that ($ is the shell prompt) :

$sudo /usr/bin/su -root /usr/bin/who"[space]
> id"
bob       pts/1   Dec 12 12:12      (X.X.X.X)
uid=0(root) gid=1(other)
$

Is there a way to match and deny any ctrl-j in the sudoers file ?
Is it normal that sudo gives arguments with ctrl-j (ie newlines)
to a command ?

Thank you in advance for your help.

Fabrice GONTON


-------------- next part --------------


Ce message contient des informations confidentielles ou appartenant au 
Cr?dit Lyonnais et est ?tabli ? l'intention exclusive de ses 
destinataires. Toute divulgation, utilisation, diffusion ou reproduction 
(totale ou partielle) de ce message, ou des informations qu'il contient, 
doit ?tre pr?alablement autoris?e. Tout message ?lectronique est 
susceptible d'alt?ration et son int?grit? ne peut ?tre assur?e. 
Le Cr?dit Lyonnais d?cline toute responsabilit? au titre de ce 
message s'il a ?t? modifi? ou falsifi?. Si vous n'?tes pas 
destinataire de ce message, merci de le d?truire imm?diatement et 
d'avertir l'exp?diteur de l'erreur de distribution et de la destruction
du message.
Cr?dit Lyonnais, SA au capital de Euros 1.807.874.827 - RCS Lyon B 954 509 741
Si?ge Central : 19, boulevard des Italiens. 75002 Paris. France

This e-mail contains confidential information or information belonging 
to Cr?dit Lyonnais and is intended solely for the addressees. 
The unauthorised disclosure, use, dissemination or copying (either whole 
or partial) of this e-mail, or any information it contains, is prohibited.
E-mails are susceptible to alteration and their integrity cannot be guaranteed. 
Cr?dit Lyonnais shall not be liable for this e-mail if modified or falsified.
If you are not the intended recipient of this e-mail, please delete it 
immediately from your system and notify the sender of the wrong delivery 
and the mail deletion.
Cr?dit Lyonnais SA.
Share Capital of Euros 1.807.874.827.
Registered Office : Lyon (B 954 509 741) 
Central and administrative Office : 19, boulevard des Italiens. 75002 Paris. France


More information about the sudo-users mailing list