rmdir unable to remove directory than is 0wned by me and has me as group

7 réponses [Dernière contribution]
buildcomplete
Hors ligne
A rejoint: 01/26/2015

rmdir unable to remove directory than is 0wned by me and has me as group

it might just be some finer details that I misses about the filesystem...
could you please fill me in :)

I did
> sudo mkdir /usr/share/test
> sudo chown christian:christian /usr/share/test
> rmdir /usr/share/test
rmdir: failed to remove ‘/usr/share/test’: Permission denied

whaaat???

> ls -la /usr/share/ | grep test
drwxr-xr-x 2 christian christian 4096 jan 30 22:09 test

I even did:
> chmod 777 /usr/share/test
> rmdir /usr/share/test
rmdir: failed to remove ‘/usr/share/test’: Permission denied

> sudo rmdir /usr/share/test
removed the file with no problem...

Trisquelian
Hors ligne
A rejoint: 01/23/2015

It depends on the parent directory, in this case it is /usr/share . If this parent directory does not give you write permission, you won't be able to remove/edit/create files within this directory.
When you want to write outside of the /home/$USER/ directory with one of the Desktop users it is a better idea to get a directory that is owned by you first, let's say /user/share/test and then write within that directory. You shouldn't be really creating files that are owned by anyone other than root in these places (unless it has a specific purpose, like file sharing).

To understand this better you really have to read about linux permissions. It is also not a good idea to fiddle with the permissions on files owned by root unless you know what you are doing or it's just a testing environment.

buildcomplete
Hors ligne
A rejoint: 01/26/2015

Hi Trisquelian,

I know I should take care with the permissions, so this was purely a test and I would not do that in general :)

I guess it makes sense that it is the parent directory I need write access to to delete a directory from, since I guess there is some structure represented by the parent directory that I modify.

I tried to sudo mkdir /usr/share/test/test and was able to remove it using rmdir /usr/share/test/test, even tough test/test was owned by root.
The testing is spawned by some problems I have that I cannot get the 'atom text editor' to delete files:
see here https://github.com/atom/tree-view/issues/345#issuecomment-71965220

Trisquelian
Hors ligne
A rejoint: 01/23/2015

I can't really help you with Atom as I had never heard of it prior to your comment.
Unless you include an excerpt from this process directly from the command line it is going to be hard to help you further than what I told you above.

buildcomplete
Hors ligne
A rejoint: 01/26/2015

yep, the thing is,

that when I start atom from the shell, it doesn't block the shell as 'normal' application does... and it doesn't output anything. so I don't see any error messages at all from it. It is apparently supposed to write some messages to it's internal debug console, but nothing goes there either.

I am wondering if there somewhere is send a message to 'X' that results in an error... I just don't know where to look....

davidnotcoulthard (non vérifié)
davidnotcoulthard

Try rm -r --interactive=never [directory name].

buildcomplete
Hors ligne
A rejoint: 01/26/2015

same problem as above
(which I guess is good)

davidnotcoulthard (non vérifié)
davidnotcoulthard

Try doing it with sudo, or enable anyone to change the parent directory's content (can be done with a GUI file manager - no idea how to do it the proper through-BASH way).