logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: Aliasing rm to rm -i for sudo: msg#00194

Subject: Re: Aliasing rm to rm -i for sudo
R (Chandra) Chandrasekhar wrote on Mon, Jun 20, 2005 at 16:16:01 +0800:
> Dear Folks,
> 
> I have aliases for rm to be rm -i in the .bashrc files for an ordinary 
> user as well as for root so:
> 
> alias rm='rm --interactive'
> 
> When I do rm <filename> as an ordinary user, I am asked to confirm deletion.
> 
> Likeweise, after sudo -s -H, when I do rm <filename> I am asked to 
> confirm deletion.
> 
> However, if I do sudo rm <filename> deletion proceeds without 
> interactive confirmation.
> 
> How may I alias rm to rm -i for sudo?

I don't know any possibility for shell aliasing arguments.
The aliasing is a shell input feature.
/usr/bin/sudo and /bin/sh -c "X" executes programs without any input parsing.
I think it would be a security leak if any replacement like aliasing
would be done in such executions.

You can force sudo to accept /bin/rm only with "-i" or "-f" argument.
Read for this "man 5 sudoers" and use visudo.



<Prev in Thread] Current Thread [Next in Thread>