sudo doesn't support bash aliases

Daniel Robitaille robitaille at gmail.com
Sun Mar 20 15:10:35 CST 2005


On Sun, 20 Mar 2005 21:34:53 +0100, Ricardo Pérez López <ricpelo at ono.com> wrote:
> 
> Hi again, list.
> 
> I have a question about sudo.
> 
> I come from Debian, in which I didn't use sudo, but the root account,
> for admin tasks.
> 
> I used this bash aliases, for both the "normal" user and the root user:
> 
> alias rm='rm -i'
> alias cp='cp -i'
> alias mv='mv -i'
> 
> With that way, when I type "rm file", it is translated to "rm -i file",
> asking me about if I'm sure or not erasing the file.
> 
> But "sudo rm file" doesn't takes care of the alises. "sudo rm file" is
> not translated to "sudo rm -i file".
> 
> I've tried to put the aliases in six different places:
> 
> - user's .bash_profile
> - user's .bashrc
> - root's .bash_profile
> - root's .bashrc
> - /etc/profile
> - /etc/bash.bashrc
> 
> But I have no success. sudo doesn't use bash aliases.
> 
> Is there any way to do sudo takes care of the bash aliases?
> 
> Thanks a lot.
> 
> Ricardo.

this type of question should go to the users list instead of the
developpers list.

(as for one  answer...put the aliases in root's .bashrc and then use
"sudo -s -H" to get a root prompt)



More information about the ubuntu-devel mailing list