LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-17-2014, 08:08 AM   #1
djole
LQ Newbie
 
Registered: Feb 2014
Posts: 3

Rep: Reputation: Disabled
Change group or permissions when a file is moved to a shared directory on Linux


I've set up a Linux server accessible with ssh and Samba share. Every user has his own folder USER/ and a public folder USER_public/. Permissions on the USER_public/ are set up using setfacl in such way that every new file created in that folder inherits permissions and ownerships from the parent directory (in this case, read and write permissions for others).
The problem I have is that files that are moved from USER/ to USER_public/ do not inherit these permissions automatically.
Is there a way of making the moved (copied) files to inherit permissions from the parent directory automatically. I want to avoid users manually connecting via ssh and changing the permissions using chmod.
Thank you.
getfacl output :
Code:
# file: user1_public
# owner: user1
# group: group1
# flags: -s-
user::rwx
group::rwx
group:super_group1:rwx
mask::rwx
other::rw-
default:user::rwx
default:group::rwx
default:group:super_group1:rwx
default:mask::rwx
default:other::rw-
 
Old 02-17-2014, 09:05 AM   #2
yongitz
Member
 
Registered: Nov 2005
Location: Davao City, Philippines
Distribution: RHEL, CentOS, Ubuntu, Mint
Posts: 139

Rep: Reputation: 20
have you tried setting the using sticky bit?

Quote:
chmod g+s user1_public
 
Old 02-17-2014, 09:47 AM   #3
djole
LQ Newbie
 
Registered: Feb 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by yongitz View Post
have you tried setting the using sticky bit?
The sticky bit is on, hence the
Code:
#flags -s-
part of the getfacl output.

Also ls -l says:

Code:
drwxrwsrw-+  7 user1   everyone_group      4096 Feb 14 13:28 User1_public
The problem is that the sticky bit seems to work when someone is creating a new file inside of
the PUBLIC folder. If someone is moving a file, the file keeps the permissions from the private folder.
 
Old 02-17-2014, 11:11 AM   #4
yongitz
Member
 
Registered: Nov 2005
Location: Davao City, Philippines
Distribution: RHEL, CentOS, Ubuntu, Mint
Posts: 139

Rep: Reputation: 20
Didn't notice that at first. But I believe that should work even without the sticky bit. I believe the sticky bit would be useful if you change the group of the entire folder to super_group1.

I'll test this out using your setup and will get back to you.
 
Old 02-17-2014, 12:19 PM   #5
djole
LQ Newbie
 
Registered: Feb 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
I've noticed that it applies to files but not to directories and sub elements of said directories.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Secondary group users need to change the file permissions of primary group files? sunnybmv Linux - Newbie 3 12-10-2009 04:57 PM
scrip to change directory/file permissions ramesh14 Programming 4 09-11-2008 01:35 PM
NFS Sever Shared Directory - File Permissions Problem LakeWind Linux - Server 1 06-12-2007 02:51 AM
Trying to traverse a directory to change file permissions bskrakes Linux - Newbie 4 09-14-2006 04:38 PM
recursive file permissions does not change new files in same directory PAB Linux - Newbie 2 03-08-2004 12:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:01 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