LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-01-2024, 02:14 AM   #1
swami77
LQ Newbie
 
Registered: Feb 2024
Posts: 1

Rep: Reputation: 0
Understanding permissions needed to mv directory (using Posix ACLs)


I have a folder A inside a folder B, which is in turn in a folder C (all on the same file system). I want to mv A from B to C, but I get a permission denied error.

I can mv A within B (i.e. rename A)

Now I mv A to C as the root user (successfully)

I can now mv/rename A within C

└── [drwxrwx---] C
├── [drwxrwx---] B
│ └── [drwxr-x---] A

getfacl C
# file: C
# owner: root
# group: root
user::rwx
user:myuser:rwx
group::rwx
mask::rwx
other::---

getfacl B
# file: B
# owner: root
# group: root
user::rwx
user:myuser:rwx
group::rwx
mask::rwx
other::---

getfacl A
# file: A
# owner: otheruser
# group: othergroup
user::rwx
user:myuser #effective:r-x
group::rwx #effective:r-x
mask::r-x
other::---

mv A ..
mv: cannot move ‘A’ to ‘C’: Permission denied
This doesn't make sense to me, since I understood moving a directory only requires write permissions on the current parent and the target directory. Since I can rename the dir in both directories, surely I should be able to mv it from one to the other!

Additional notes:

The permission is granted via an ACL named user entry (myuser), that exists on both B and C and which has rwx permissions
These folders are contained within a Samba share - but even if I stop the smb service I still have the same problem, so I don't think that has any impact.
SELinux is in Permissive mode
There is no existing folder in C also named A
If I do sudo chmod g+w A, then I can move A successfully. But why does the permissions on the folder being moved have an impact?
OS is CentOS 7, and the file system is ext4. The file system was not mounted explicitly with acl support (but acls seem to work nonetheless - except for this one issue). tune2fs -l shows "Default mount options: user_xattr acl"
 
Old 02-01-2024, 03:07 AM   #2
lvm_
Member
 
Registered: Jul 2020
Posts: 960

Rep: Reputation: 340Reputation: 340Reputation: 340Reputation: 340
Moving A to a different parent directory requires modification of .. entry within A which requires write access to A which you don't have.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help needed with acls and samba server dbeck Slackware 2 01-27-2010 02:39 PM
help with permissions without using ACLs ehco2121 Linux - Newbie 1 02-09-2008 06:07 PM
Why aren't Posix ACLs installed by default by Linux HGeneAnthony Linux - Security 8 05-06-2006 07:38 AM
Posix ACLs are only working on directories HGeneAnthony Linux - Security 3 04-07-2006 11:39 AM
Fedora Core 3, Windows ACLs, POSIX ?? jabran Fedora 6 06-24-2005 10:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration