Not deleting directory
Hello,
[root@myServer cgi-bin]# rm -rf test rm: cannot remove directory `test': Permission denied [root@myServer cgi-bin]# ls test [root@myServer cgi-bin]# ls -la total 12 drwxr-x--- 3 10040 psaserv 4096 May 2 2010 . drwxr-xr-x 3 root root 4096 Mar 21 01:16 .. drwxr-xr-x 2 10040 psacln 4096 Mar 21 01:11 test [root@myServer cgi-bin]# Regards |
Is the file system mounted read-only?
What is the line for it in cat /proc/mounts output? |
Quote:
/dev/root / ext3 rw,data=ordered 0 0 /dev /dev tmpfs rw 0 0 /proc /proc proc rw 0 0 /sys /sys sysfs rw 0 0 /proc/bus/usb /proc/bus/usb usbfs rw 0 0 devpts /dev/pts devpts rw 0 0 /dev/sda1 /boot ext3 rw,data=ordered 0 0 tmpfs /dev/shm tmpfs rw 0 0 none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0 sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0 /etc/auto.misc /misc autofs rw,fd=6,pgrp=2835,timeout=300,minproto=5,maxproto=5,indirect 0 0 -hosts /net autofs rw,fd=12,pgrp=2835,timeout=300,minproto=5,maxproto=5,indirect 0 0 /proc /var/named/run-root/proc proc rw 0 0 /dev/root /var/named/run-root/var/run/dbus ext3 rw,data=ordered 0 0 tmpfs /usr/local/psa/handlers/before-local tmpfs rw 0 0 tmpfs /usr/local/psa/handlers/before-queue tmpfs rw 0 0 tmpfs /usr/local/psa/handlers/before-remote tmpfs rw 0 0 tmpfs /usr/local/psa/handlers/info tmpfs rw 0 0 tmpfs /usr/local/psa/handlers/spool tmpfs rw 0 0 regards |
They are all mounted rw. Is the directory "test" on one of them?
|
Thanks again for reply
Its in each and every /var/www/vhosts/domainName/cgi-bin/test regards |
Are the /var/www/vhosts/<domain name>/cgi-bin/test files on the / file system as appears from /proc/mounts? There's still the possibility they are on a network file system.
Are there any extra access controls? /bin/ls -l test would show a . or a + after the permissions if there were. Please use /bin/ls not ls to ensure no alias is in use. |
[root@myServer cgi-bin]# /bin/ls -l
total 4 drwxr-xr-x 2 medical5 psacln 4096 Dec 18 04:15 test thanks again |
Ah ...
Can you change the holding directory's owner to root? chown root . If that works, can you then delete it? (I'm not expecting it to work because the -f option of rm should have dealt with that case). Try using /bin/rm -- again to avoid possible alias complications. |
Hello,
Try listing the directory attributes: $ lsattr test Is immutable attribute set? (if it is, you will see an "i" among the listed attibutes, like this ----i--------e- . To unset it, like root type: # chattr -i test And now (as user) you can try to delete it again. If it fails, verify that any file inside it do not have immutable attribute set. Good luck! |
[root@myServer cgi-bin]# chattr -i test
[root@myServer cgi-bin]# rm -rf test rm: cannot remove directory `test': Permission denied |
Is there something using that directory? lsof <path_to_directory>
You may need to stop something that is accessing that file location. |
Quote:
chattr -R -i test would remove it from the directory and anything under it. lsattr -R test to see if there are any attributes set on the directory and anything under it. |
In your first post, the owner is UID 10040
In your fourth post, the owner is medical5 What has changed between the first and fourth posts? Usually when the owner is just a UID, not an actual username, it means you're working on a network filesystem (NFS, etc), which means root won't have the same permissions as on the local filesystem. |
[root@myServer cgi-bin]# chown root test
[root@myServer cgi-bin]# /bin/rm -rf test /bin/rm: cannot remove directory `test': Permission denied [root@myServer cgi-bin]# /bin/rm -f test /bin/rm: cannot remove `test': Permission denied [root@myServer cgi-bin]# /bin/rm test /bin/rm: cannot remove `test': Permission denied [root@myServer cgi-bin]# ---------- Post added 03-21-12 at 11:56 AM ---------- [root@myServer cgi-bin]# lsattr test [root@myServer cgi-bin]# ls -l total 4 drwxr-xr-x 2 root psacln 4096 Mar 21 01:11 test [root@myServer cgi-bin]# chattr -i test [root@myServer cgi-bin]# ls test [root@myServer cgi-bin]# rm -rf test rm: cannot remove directory `test': Permission denied [root@myServer cgi-bin]# cd test [root@myServer test]# ls |
[root@myServer cgi-bin]# lsof test
[root@myServer cgi-bin]# ---------- Post added 03-21-12 at 11:58 AM ---------- [root@myServer cgi-bin]# chattr -i test [root@myServer cgi-bin]# chattr -R -i test [root@myServer cgi-bin]# lsattr -R test [root@myServer cgi-bin]# ls test [root@myServer cgi-bin]# rm -rf test rm: cannot remove directory `test': Permission denied [root@myServer cgi-bin]# |
All times are GMT -5. The time now is 07:47 AM. |