LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Permission denied to root trying to remove directory (https://www.linuxquestions.org/questions/linux-newbie-8/permission-denied-to-root-trying-to-remove-directory-898556/)

7kaltoid 08-20-2011 11:04 PM

Permission denied to root trying to remove directory
 
Trying to rmdir in Opensuse 11.1 as root. Error returned is "Permission denied". Perms are drwxrwxsr-x.

I have tried command line and Konqueror with equally dismal results.

Also, tried to search for an answer without luck. I am a casual linux user only.

Help!

siranjeevi 08-20-2011 11:30 PM

Hi,

Seems like the folder has attributes set in it. Can you try the following command.?.. and paste the output here.

lsattr <filename>

jdkaye 08-21-2011 12:28 AM

Quote:

Originally Posted by siranjeevi (Post 4448982)
Hi,

Seems like the folder has attributes set in it. Can you try the following command.?.. and paste the output here.

lsattr <filename>

lsattr is only useful for ext2 file systems. Most people are using some other fs such as ext3/ext4. The command yields uninteresting results on those systems:
Code:

~$ lsattr hardware.txt
--------------- hardware.txt

@7k You need to remove the directory as root or using sudo.
ciao,
jdk

druuna 08-21-2011 03:19 AM

Hi,
@jdkaye:
Quote:

Originally Posted by jdkaye
lsattr is only useful for ext2 file systems. Most people are using some other fs such as ext3/ext4. The command yields uninteresting results on those systems:

lsattr and chattr work perfectly on a ext3 (and probably ext4/ReiserFS):
Code:

$ grep tmp /etc/fstab
/dev/sdb3      /tmp                    ext3      defaults        0    2

$ cd /tmp/
$ touch foobar
$ lsattr foobar
------------- foobar
$ chattr +i foobar
$ lsattr foobar
----i-------- foobar
$ rm -f foobar
rm: cannot remove `foobar': Operation not permitted
$ chattr -i foobar
$ lsattr foobar
------------- foobar
$ rm foobar

I do agree that the OP's problem is probably not related (different error message), but it is worth checking. I am assuming an ext2/3/4 FS is being used. It has been a while since I used SuSe, it did use reiserFS and I do remember reading somewhere that there is a lsattr/chattr that supports this FS.

Hope this helps.

jdkaye 08-21-2011 03:41 AM

Quote:

Originally Posted by druuna (Post 4449072)
Hi,
@jdkaye:


lsattr and chattr work perfectly on a ext3 (and probably ext4/ReiserFS):

I do agree that the OP's problem is probably not related (different error message), but it is worth checking. I am assuming an ext2/3/4 FS is being used. It has been a while since I used SuSe, it did use reiserFS and I do remember reading somewhere that there is a lsattr/chattr that supports this FS.

Hope this helps.

I was basing myself on the info lsattr entry:
Quote:

LSATTR(1) LSATTR(1)

NAME
lsattr - list file attributes on a Linux second extended file system
I interpreted "Linux second extended file system" to mean ext2. Was I wrong?
thanks,
jdk

druuna 08-21-2011 03:47 AM

Hi,
Quote:

Originally Posted by jdkaye (Post 4449082)
I interpreted "Linux second extended file system" to mean ext2. Was I wrong?

Yes ;)

The man page does explicitly mention ext2, but it does work on ext3 (as I showed in my previous post). I don't have access to ext4/ReiserFS at the moment, but I'm almost certain it works on ext4. Don't know about ReiserFS though, I do believe you need a patched lsattr/chattr version.

Hope this helps.

sahabcse 08-21-2011 04:06 AM

Who is the owner of the file. Pls paste the following o/p
ls -al filename

7kaltoid 08-21-2011 01:04 PM

DIR owner is root:root

Someone suggested removing the parent directory. As I look back on it, that's not something I tried. Stay tuned and thanks for all the info so far.

7kaltoid 08-21-2011 01:14 PM

That fixed it.

Thanks again.

jv2112 08-21-2011 08:05 PM

The directory has the SGID ( Octal 2775 ) set. So the directory contents permissions are determined by the group. In this case root. So the only two sets of people who can write to the files or directory are the group or owner. You would need to modify as root ( su / sudo ) .


Hope this helps. :)

rob.rice 08-22-2011 01:51 AM

rmdir - remove empty directories
is it empty ?


All times are GMT -5. The time now is 10:09 AM.