Linux permissions, mv is denied

1

I have the following structure (property is in the form user:group, user A belongs to both groups A and B, user B is just in the B group) :

+ dir1           rwxrwxr-x     A:A
+ dir2           rwxrwxr-x     A:B
  - file1        rw-rw-r--     B:B
  + dir3         rwxrwxr-x     B:B
    -file2       rw-rw-r--     B:B

I (as user A) want to move file2 to dir1. When I do so, I get a "Permisson denied" error (while moving file1 to dir1 is working fine). As a result file2 is copied in dir1 but still remains in dir3 as if the group write permission was ignored for the suppression.

What is the problem here?

EDIT:

Maybe there's a problem with the group assignation, here's the result of a few commands:

$ whoami
A
$ groups
A                   <-- ??? why
$ groups A
A : A B

Moreover, the mv I'm trying to do is in a script called by a crontab job, and it's working frmo there. Is there something to do to "refresh" groups assignments?

gregseth

Posted 2014-04-21T13:02:58.673

Reputation: 459

When you try to move the file out of folder 3 which is owned by B:B then you write to that folder. As I read the question you do not have permission to do that. (Making a copy which only reads file2 and then writes it to your directory (dir2) should work. But mv and deleting dir3/file2 should fail). – Hennes – 2014-04-21T13:27:29.817

Let met rephrase then: Deleting a file from dir3 is allowed to user B and group B (775), since user A is in group B, why is it not allowed? – gregseth – 2014-04-21T22:27:03.873

Answers

0

Ok, apparently you have to logout for the changes to take effect, this topic explains how to bypass the logout if needed.

gregseth

Posted 2014-04-21T13:02:58.673

Reputation: 459