TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:2572] I think this works!



On Sat, 5 Dec 1998, Shawn T . Amundson wrote:

> > 1. $DELETEDIR = "$ENV{'HOME'}/.Trash" (I like for the trash can to be
> > hidden.)
> 
> Definately a better location.

Just to clarify, it is essentially the same location as Ben's original
script (~/<somename>) -- I just assign the $DELETEDIR differently than
Ben.

> > 2. Change the cp-ing to mv-ing (since there's no chance we could be
> > crossing paritions) and don't do the 'rm' step ('mv' precludes it). This
> > is much more efficient than copying and removing.
> 
> That's not good assumption.  Even if in this particular case it may
> be valid, going the extra foot here is worth the effort so the script
> can be reused on a different system.

As I said, I wouldn't use it for anyone except normal, low-priveleged
users -- on *any* system.

> A better solution would be to provide 'nrm' and alias rm to rm -i.

Yes, you're right. I'll put the script in /bin/del and be happy. (This
also solves a problem you mentioned: confusing new users. The best thing
to do would be to tell users to use /bin/del and provide a man page for
it. Fwiw, this script (as both Ben and I have it) does everything 'rm'
does: -r is not needed, as you can 'mv' both files and directories;
and -[i|f]  is not needed since you're not destroying anything.)

> > This isn't the kind of thing I would ever do as root, for security reasons
> > among others, so the test to check if the user is root can go (unless you
> > want to make it exit safely if the user is root).
> 
> As long as it's not setuid root, in root's normal path, and the script is 
> only writable by root, then what are the security reasons?

I dunno...it's just my instinct to never auto-run code as root, and to not
have anything like /root/bin. Just superstition made me say that, more
than anything else. :)

> As a side note, in order to get the real username and home directory of the 
> process, do something like this:

[snip wise advice]

Thanks!

_____________________________________________________________________________
Christopher Reid Palmer : reid@pconline.com : innerFire on IRC (EFNet)

"Luminous beings are we. Not this...crude matter."  -- Yoda