On Fri, 2006-01-06 at 13:19 -0700, Robin Laing wrote: > Mike McCarty wrote: > > Robin Laing wrote: > > > >> Alastair McKinley wrote: > >> snip > > > > Soooo true. Which is why one should never > > > > (1) log on as root > > (2) use aliased commands for root for > > (a) rm > > (b) mv > > (c) etc. > > which have "-f" on them > > (3) use sudo for commands like (a)-(c) above, > > (only use sudo for *list* type commands) > > (4) hit return before checking, looking away, > > and checking again. > > > > > > Mike > > The first thing I usually do is make an aliases for rm, cp and mv to > ask for confirmation. > > alias rm='rm -i' This is the default setting for root (you can check by running 'alias') and takes effect when you do an 'su -'. However, the -f overrides that (man rm). The OP used rm -rf so it would not have mattered at all if the -i option was set by default. His typo was a bit destructive. > alias cp='cp -i --backup=t' > alias mv='mv -i --backup=t' The addition of the --backup option for mv might be nice. 'cp -i' and 'mv -i' are already aliases for root. Why would I want a backup of a file I am copying? I am already making a copy and not changing the original. [root@eagle SL]# alias alias cp='cp -i' alias l.='ls -d .* --color=tty' alias ll='ls -l --color=tty' alias ls='ls --color=tty' alias mv='mv -i' alias rm='rm -i' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' This is the default list of aliases configured for root on my FC4 system. > > I wonder if there is a way to disable the "-f" option in rm as root. > I would not want to! Using the -f option implies you know what you are trying to do. If you did it would take a reply to a prompt for *each* file being deleted. Imagine if you were removing a large directory tree! Even several hundred files would be extremely irritating (and doing software development can easily result in a tree of that size quickly). My rule of thumb is *always check what you type*, then *think* before hitting the enter key. This was a hard learned lesson from some time back with a typo that left my command "rm -rf / ......." using a full path to a file. And you *know* what that did ;-(. > I also want to look at the terminal settings and see if I can get the > background to change when I su. > That is a very good idea. An extra reminder that you are in a dangerous environment.