Operating System - HP-UX
1752822 Members
4277 Online
108789 Solutions
New Discussion юеВ

directory owned by root but cannot delete

 

directory owned by root but cannot delete

I somehow screwed up the permissions on a directory and cannot delete it. The directory is in a user's home directory, is owned by root, and the group is bin. Permissions are 700. I am the root user and cannot chmod, chgrp. rmdir, or anything else to the directory. I cannot even cd into it. Any ideas?
11 REPLIES 11
Patrick Wallek
Honored Contributor

Re: directory owned by root but cannot delete

What is the directory name? What errors, if any, do you get when you try to do anything to/with that directory?

Re: directory owned by root but cannot delete

Directory is /home/username/usr

Outputs as follows:
#ls -lart
drwx------ 3 root bin 96 Jan 23 14:36 usr

#chmod 777 usr
chmod: can't change usr: Not owner

# chgrp sys usr
usr: Not owner

# cd usr
sh: usr: Permission denied.
Patrick Wallek
Honored Contributor

Re: directory owned by root but cannot delete

Are you sure you are root? It appears that you are not, even though you have a '#' prompt.

At the prompt type 'id' and let us know what that returns, please.

Re: directory owned by root but cannot delete

At the prompt an id command gives me:

# id
uid=0(root) gid=3(sys) groups=0(root),1(other),2(bin),4(adm),5(daemon),6(mail),7(lp),20(users)
Ivan Krastev
Honored Contributor

Re: directory owned by root but cannot delete

Check for access control lists with lsacl - http://docs.hp.com/en/B3921-90010/lsacl.1.html

regards,
ivan
Dennis Handly
Acclaimed Contributor

Re: directory owned by root but cannot delete

Is that directory over NFS? It may be exported with "root is less than nobody" option.

What does "bdf /home/username/usr" show?
Dennis Handly
Acclaimed Contributor

Re: directory owned by root but cannot delete

If over NFS, you will have to change how it is exported. Or you will have to change the owner/permissions on the server.
D Anderton
Advisor

Re: directory owned by root but cannot delete

Try looking for hidden chars in the directory name. You probably have a control character in there that will not be displayed. Try rm -i * or one I sometimes use us ls >file.txt vi file.txt and you will see the hidden chars. You can then insert rm -i before the filename and place it in "". Exit and run the file. sh file.txt....
Dennis Handly
Acclaimed Contributor

Re: directory owned by root but cannot delete

>Damian: Try looking for hidden chars in the directory name.

I doubt this is the problem because the error message didn't say it wasn't found.

>I sometimes use use ls > file.txt vi file.txt and you will see the hidden chars.

You can see them directly with ls -b.