#122 protect existing files from shell redirection

open
nobody
None
5
2006-08-14
2006-08-14
Anonymous
No

In bash, I always turn on some security measures
(against myself), like "set -o noclobber", that protect
existing files from being overwritten by a ">"
redirection (I still can use ">|" to overwrite it).

As I can run interactive commands in Webmin's shell, I
usually do some edits on config files with the command
line tools: removing lines with "grep -v", adding new
ones with "echo >>". It's very dangerous to ruin a file
by acidentally using ">" instead of ">>", running the
command in the wrong directory, or some mistake like that.

So it would be very nice to have the option, in the
Command Shell module, to set the noclobber option somehow.

One way could be a text box of commands to be passed to
the shell, much like a .bashrc file.

Other nice security aliases, like
alias mv='mv -i'
alias cp='cp -i'
require interaction, so it would be harder to make it work.
Maybe the Command Shell could have a readline interface
(with LD_PRELOAD, or something), but that's a topic for
another feature request entry. :)

Discussion

  • Rodolfo Borges
    Rodolfo Borges
    2006-08-14

    Logged In: YES
    user_id=311242

    Hey, that was me. The 'back' button ruined my login session..

     
  • Rodolfo Borges
    Rodolfo Borges
    2006-09-05

    Logged In: YES
    user_id=311242

    In the second paragraph, s/can/can not/