l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
January 6: Social gathering
Next Installfest:
TBD
Latest News:
Nov. 18: Club officer elections
Page last updated:
2001 Dec 30 16:58

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Can't Remove File
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Can't Remove File



To continue the discussion of removing files whose initial character is a '-',
I found this excerpt from Phrack issue No. 6 (the article is from file no. 5,
on sabotaging Unix systems ;) ):

<<
Messing Up A Directory
----------------------
Many file-handling commands use "-" options.  Create a file with a "-" at the
beginning of its name by doing this:

cat > -filename

[now type a few lines, maybe something rude like "ha ha you can't delete this
file".]  Type a ^D (control-d) to end input.  You now have a file called
-filename in your directory.  It will be VERY difficult to remove this file.
If you were to try rm (remove) -filename or mv (rename) -filename, the rm or mv
program would interpret -filename as an option, not a file, and would give you
an error message telling you that -filename was not a valid option...thus, the
file stays there obnoxiously.

Create a couple of hundred files with "-" as the first characters in their
names...it will be a royal pain for the person who is blessed with these new
files, and they will probably just have to get a new login.
>>

I suspect that GNU's use of the '--' argument was intended to answer
this problem, as I'm sure it became fairly common for malevolent users to
try stuff like this.  On older UNIX systems, I'd imagine the sysop would have
to write a quick an' dirty C program which unlinks argc[1] without processing
for options.

On Sun, Nov 26, 2000 at 04:15:21PM -0800, Peter Jay Salzman wrote:
> i will gladly answer this.   harry souders (did you realize your name is an
> anagram of sudoers?) answered this for me about half a year ago.  i even
> remember the subject of the email i sent.  it was something like 'i can't
> believe i'm asking this..'  :)    frustrating, ain't it?
> 
> rm -- -g
> 
> the -- as i understand it tells rm that there's no more options coming.
> therefore, anything to the right of -- gets interpreted as a file.
> 
> pete
> 
> 
> On Sun, 26 Nov 2000, Robert G. Scofield wrote:
> 
> > Date: Sun, 26 Nov 2000 16:02:03 -0800
> > From: Robert G. Scofield <rgscofield@ucdavis.edu>
> > Reply-To: vox-tech@lists.mother.com
> > To: Vox-Tech <vox-tech@lists.lugod.org>
> > Subject: [vox-tech] Can't Remove File
> > 
> > Typing the ls command I discovered that I have a file created yesterday
> > called -g.
> > 
> > Can anybody tell me how I can get rid of this file?


LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!