LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-03-2005, 03:03 PM   #1
mattie_linux
LQ Newbie
 
Registered: May 2005
Posts: 15

Rep: Reputation: 0
uid, gid don't exist, yet files owned by them, i need to delete them



hi,
please excuse my English.
I have a file, "wackyfile", owned by some crazy uid/gid that doesn't exist, and I want to remove it. It is local:

%ls -al
d--xr-x--x 2 8150884 13459827 49152 Feb 13 1971 wackyfile

I have no idea how the user/file got created. I have never had a user with that UID. But we are in an NFS environment, and I have see crazy stuff before.
-
As root, when I try to delete them, I get "permission denied" :

% rm -rf wackyfile/
rm: cannot open directory `wackyfile/.': Permission denied
rm: cannot remove directory `wackyfile': Operation not permitted

-
So I think, the permissions are bad (before it tries to remove, it tries to open, but can't. So the first step is just to chmod it! but as root, I can't change the permissions with chmod.

So what I did, was create a local user in /etc/passwd and /etc/group, with the corresponding uid/gid, "gooduser"

$ ls -al
d--xr-x--x 2 gooduser gooduser 49152 Feb 13 1971 wackyfile

--
Ah. Not to crazy looking now! But I still can't rm this stuff:

$ whoami
gooduser

$ rm -rf wackyfile/
rm: cannot open directory `wackyfile/.': Permission denied
rm: cannot remove directory `wackyfile': Operation not permitted
-
What's going on? I'd appreciate any pointers to tools that can tell me deeper information about this file.

thanks,
mattie

Last edited by mattie_linux; 05-03-2005 at 05:35 PM.
 
Old 05-03-2005, 04:06 PM   #2
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
according to your transcript, you didn't chmod it with the new user either.

$ whoami
gooduser
$ chmod 0777 wackyfile
$ rm -rf wackyfile

hth --Jonas
 
Old 05-03-2005, 05:26 PM   #3
mattie_linux
LQ Newbie
 
Registered: May 2005
Posts: 15

Original Poster
Rep: Reputation: 0
Hi Jonas. thanks for the reply.
(sorry, I meant to say that I tried chmod, too)

$ whoami
gooduser

$ chmod 0777 wackyfile
chmod: changing permissions of `wackyfile': Operation not permitted

mattie
 
Old 05-03-2005, 05:33 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
You forgot to mention whether wackyfile is on a local
or remote file-system ...
 
Old 05-03-2005, 05:35 PM   #5
mattie_linux
LQ Newbie
 
Registered: May 2005
Posts: 15

Original Poster
Rep: Reputation: 0
Hi there Tinkster. Good question. It is local.
mattie
 
Old 05-03-2005, 06:15 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
File-system, mount options, ... ?
 
Old 05-04-2005, 02:42 AM   #7
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Rep: Reputation: 32
If you run ext2 try
$ lsattr wackyfile
If you see something other than ------------- this means that the file attributes are messed. One of them was (i) data journaling, which doesn't permit the file to be renamed ot deleted. You could see man chattr.
 
Old 05-04-2005, 12:27 PM   #8
mattie_linux
LQ Newbie
 
Registered: May 2005
Posts: 15

Original Poster
Rep: Reputation: 0
Ivanatora,
OK, I think your tip has gotten me on the right track! When I run "lsattr" I get nothing back! So the file attributes are messed up! I looked at chattr's man, ran chattr -i on "wackyfile" and still can't remove. I will do some googling on chattr/lsattr, and follow up. Hopefully I'm close!
mattie
 
Old 05-04-2005, 01:48 PM   #9
mattie_linux
LQ Newbie
 
Registered: May 2005
Posts: 15

Original Poster
Rep: Reputation: 0
RESOLVED!
I ran:
$ chattr -ai wackyfile
and then *was* able to rm successfully.

The man page was difficult for me to understand. They mention each attribute (a,i, etc) but don't describe them as arguments really, those attributes are buried in paragraphs, as opposed to being set along the edge of the man page, in a column.

thanks to everybody to responded, it's so generous of you!

mattie
 
Old 05-05-2005, 02:45 AM   #10
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Rep: Reputation: 32
I'm glad you've found the answer
 
Old 05-05-2005, 03:57 AM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Technically, to the kernel that is a file, however, to us humans, it's a directory
d--xr-x--x 2 8150884 13459827 49152 Feb 13 1971 wackyfile

If this is a partition that is world writable, you might look for other similar directories.
You system may perform periodic checks for unowned files and directories.

Also, sometimes a file will be difficult to delete because of the characters chosen 'such as '-- filename'. In such a case, try the unlink command. It uses a different function and may work where rm fails.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what is uid and gid rmanocha Linux - Software 9 08-18-2008 11:03 PM
What is my uid/gid? Jeebizz Slackware 2 11-22-2005 11:39 AM
How can I change a user's uid and gid? homesp Debian 2 05-31-2005 02:39 PM
vpopmail:- How can we efficiently use uid & gid amit_28oct Linux - Networking 4 09-30-2004 01:02 AM
changing uid, gid zeke1955 Linux - General 4 01-09-2004 11:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration