'sudo rm' doesn't ask for confirmation
'sudo rm' on a file doesn't ask for confirmation, it just removes the file even though I aliased 'rm' to 'rm -i' in a script in /etc/profile.d/
Here's the strange part though. When I first do 'su root' and THEN as root do an 'rm', it will ask for confirmation. However, when I am logged in as a non-privileged user and do a 'sudo rm', it doesn't ask for confirmation (even though I thought sudo would do so because that's how it behaved for the root user when I did 'su root'). How can I ensure that 'sudo rm' will prompt me before removing anything? |
Check the output of alias as yourself, after su root, and then
Code:
sudo bash -c alias |
Turns out if you add the following as an alias (note the extra space at the end), aliases like 'll' and 'rm' get picked up when using sudo. And it IS documented behaviour apparently.
alias sudo='sudo ' |
That's freaky. Where did you find it documented?
Even with this, do you get any output from Code:
sudo bash -c alias |
If you use this you can see the aliases.
Code:
sudo su - root -c alias |
All times are GMT -5. The time now is 06:30 PM. |