sudo doesn't support bash aliases

Ricardo Pérez López ricpelo at ono.com
Sun Mar 20 14:34:53 CST 2005


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.






More information about the ubuntu-devel mailing list