LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 09-30-2014, 11:41 AM   #1
derekpock
Member
 
Registered: Apr 2012
Location: USA
Distribution: Elementary OS Luna
Posts: 83

Rep: Reputation: 4
Hidden Permissions - Zentyal Admins unable to read User Created Folders


I am the co-administrator of a small private school's domain system. I set the system up using Zentyal 3.4 of which Windows and Ubuntu clients both connect. Students have their own personal logins with their personal "Server Drive" of 500Mb space on the server. These "Server Drives" are the users' home folders (ie, user john.smith server drive is under /home/john.smith).

I have had multiple problems with the permissions before. By mixing ubuntu's drwxrwxrwx permission system and Zentyal's ACLs, I managed to get all administrators access to the users files by creating a symlink to the home folder that only admins have permission to. I used the Zentyal File Sharing (Samba) to add this to Samba, and it worked for a while. (/userfiles is symlink to /home that only admins can access. I do this because Samba will mess up if I create a share with /home since that is what the users are using when they get their Server Drive, duplicate samba entries I guess).

Each user's home folder is owned by them as the user but owned by Administrators as the group. Perms are set to 770 for all of them, including any sub-folders, the typical user's folder will look as follows:

drwsrws--- 4 john.smith Administrators 4096 Aug 15 16:02 john.smith/

The users can access all their files, and the admins can access their files as well. The problem comes when the users create their own personal folders. In /etc/skel, the users start with a Documents and a Pictures folder. Anything in here (not including subfolders) is readable by any admin. If a user creates a personal folder anywhere (ie /home/john.smith/Computer Class), admins can't read it.

I have tried fixing the problem by doing:

for line in `ls -1`
do chown $line:Administrators $line -R
chmod 770 $line -R
done

This basically sets the permissions of all folders and files to that seen above. It still doesn't work. I've also tried doing:

setfacl -b john.smith

Still nothing. There is no difference between ACL and ubuntu's permission system results of the Documents or Pictures folder (readable) and the users' personally created folders (non-readable). What am I doing wrong here? Any suggestions to clean up this mess? How can I get these permission to how I need them to be?

Last edited by derekpock; 09-30-2014 at 02:30 PM. Reason: Cleanup
 
Old 10-01-2014, 11:36 PM   #2
Smokey_justme
Member
 
Registered: Oct 2009
Distribution: Slackware
Posts: 534

Rep: Reputation: 203Reputation: 203Reputation: 203
This happens because anything they create is dependent of the umask, which I don't really know how it work on samba and the main group the users are part of... The good news is that you can use default ACLs to fix this.. Default acls just sets defaults for new files or directories... and something like the following should help you resolve this problem for new files (if Samba doesn't actually modify permissions).

Code:
setfacl -R -m "default:group:Administrators:rwx,default:mask:rwx" john.smith
Now, about your existing directory problem.. Since you're already bound to use the acl just stick with them for everything:
Code:
chown -R john.smith:Administrators
setfacl -R -m "group::rwx" john.smith

Last edited by Smokey_justme; 10-01-2014 at 11:42 PM.
 
Old 10-02-2014, 11:38 AM   #3
derekpock
Member
 
Registered: Apr 2012
Location: USA
Distribution: Elementary OS Luna
Posts: 83

Original Poster
Rep: Reputation: 4
This is what I did, following your suggestions.

Code:
home # 11:30:22 | setfacl -R -m "default:group:Administrators:rwx,default:mask:rwx" john.smith/
home # 11:30:51 | chown -R john.smith:Administrators john.smith/
home # 11:31:11 | setfacl -R -m "group::rwx" john.smith/
home # 11:31:18 | cd john.smith/
john.smith # 11:31:22 | getfacl ReadableFolder/
# file: ReadableFolder/
# owner: john.smith
# group: Administrators
# flags: -s-
user::rwx
group::rwx
other::---
default:user::rwx
default:group::rwx
default:group:Administrators:rwx
default:mask::rwx
default:other::---

john.smith # 11:31:26 | getfacl NonreadableFolder/
# file: NonreadableFolder/
# owner: john.smith
# group: Administrators
# flags: -s-
user::rwx
user:john.smith:rwx
group::rwx
group:__USERS__:--x
mask::rwx
other::---
default:user::rwx
default:user:john.smith:rwx
default:group::--x
default:group:__USERS__:--x
default:group:Administrators:rwx
default:mask::rwx
default:other::--x

john.smith # 11:31:44 | setfacl -R -m "default:group:Administrators:rwx,default:mask:rwx" *
john.smith # 11:31:58 | setfacl -R -m "group::rwx" *
john.smith # 11:32:04 | getfacl ReadableFolder/
# file: ReadableFolder/
# owner: john.smith
# group: Administrators
# flags: -s-
user::rwx
group::rwx
other::---
default:user::rwx
default:group::rwx
default:group:Administrators:rwx
default:mask::rwx
default:other::---

john.smith # 11:32:08 | getfacl NonreadableFolder/
# file: NonreadableFolder/
# owner: john.smith
# group: Administrators
# flags: -s-
user::rwx
user:john.smith:rwx
group::rwx
group:__USERS__:--x
mask::rwx
other::---
default:user::rwx
default:user:john.smith:rwx
default:group::--x
default:group:__USERS__:--x
default:group:Administrators:rwx
default:mask::rwx
default:other::--x
I think for some reason setfacl's recursive mode isn't really recursive. After all of this I am still unable to access the files on a Windows client as admin. I am, however and oddly enough, able to log in as admin on the server and read the files all I want. Any suggestions beyond this? I think Zentyal is getting in the way some how.

EDIT: I should clarify. I CAN read from ReadableFolder from Windows Clients as admin. I CANNOT read from NonreadableFolder from Windows Clients as admin. I can read from both when logging directly onto the server as admin.

Last edited by derekpock; 10-02-2014 at 11:44 AM. Reason: clarify readability of folders
 
Old 10-02-2014, 01:00 PM   #4
Smokey_justme
Member
 
Registered: Oct 2009
Distribution: Slackware
Posts: 534

Rep: Reputation: 203Reputation: 203Reputation: 203
Hmm... Is it possible that the user that is in the Administrator group to be part of the normal users (__USERS__) group? Maybe for some reason it doesn't obey the normal group permissions and only the extended ones set on __USERS__.. Somehow I think (can't test this right now) that Windows is actually only listening to that permission in this case..

Try doing
Code:
setfacl -R -m "group:Administrators:rwx" NonreadableFolder
to test if it makes any difference..
 
Old 10-02-2014, 02:01 PM   #5
derekpock
Member
 
Registered: Apr 2012
Location: USA
Distribution: Elementary OS Luna
Posts: 83

Original Poster
Rep: Reputation: 4
Yes. User admin is part of the __USERS__ group. That would make sense why Windows only listens to that special group. I don't think I can remove this group from admin without domain logons being interrupted and affected. The integration of the active directory between Windows and this Ubuntu Server is in the dark depths of Zentyal. Their interface for adding special acls on the home directory either isn't allowed or malfunctions. Unfortunately, I don't have access to this server again until next Monday. I will try this out then, doing more research on setfacl and getfacl, and acls in general. I will let you know if this helps on Monday. Thanks for your help so far!

Last edited by derekpock; 10-02-2014 at 02:02 PM.
 
Old 10-06-2014, 11:03 AM   #6
derekpock
Member
 
Registered: Apr 2012
Location: USA
Distribution: Elementary OS Luna
Posts: 83

Original Poster
Rep: Reputation: 4
The code you provided did not help. I am still unable to access it on a Windows client. I'm testing some other stuff too now. Any more suggestions?
 
Old 10-18-2014, 12:04 AM   #7
derekpock
Member
 
Registered: Apr 2012
Location: USA
Distribution: Elementary OS Luna
Posts: 83

Original Poster
Rep: Reputation: 4
I'm still at a complete loss. I have made a very nasty work around for now, but I still need to fix these acls or hidden permissions sometime. This is NOT solved, so if you have more suggestions, let me know.
 
Old 03-31-2016, 04:38 AM   #8
fomindn
LQ Newbie
 
Registered: Mar 2016
Location: Khmelnitsky, Ukraine
Distribution: Ubuntu 14.04.4 LTS Gnome
Posts: 2

Rep: Reputation: Disabled
Question How was solved this problem?

Hi, Derekpock!

This topic is marked as "solved". Can you tell about how you solved a users access permissions problem?

Now, i use Zentyal 4.1 and i have same problem with owners and permissions for users home folders. From Zentyal web-panel i was created users and groups. And at home folder was created users folders with owner of my admin account (which i loged in Zentyal web-panel and created that users). But, as i think, its wrong. Users home folders must have as owner user_name and domain_admin as group. Can you help? Tell me, please, where and how i can set default permissions for users home folders in Zentyal?

Thanks!
 
Old 04-03-2016, 07:41 PM   #9
derekpock
Member
 
Registered: Apr 2012
Location: USA
Distribution: Elementary OS Luna
Posts: 83

Original Poster
Rep: Reputation: 4
The last post states that I made a messy work-around that I really shouldn't suggest to anyone. As of this post, I've moved and am no longer the SysAdmin with this issue. If you have this issue as well, start a new post with newer information from the newer releases.

IF YOU MUST, however, use the messy work-around I was, this is what I did:

In /etc/rc.local, add the following lines (or something similar) before the exit 0;

Code:
IFS="
"
for userFolder in `ls -1 /home | grep -v "directoryInHomeThatIsNotAUsersFolder" | grep -v "anotherDirectoryInHomeThatIsNotAUsersFolder" | grep -v "etc..."`
do
    chmod 770 "$userFolder" -R
    chown "$userFolder":ADMINISTRATOR "$userFolder" -R
done
The code above, every startup, changes the permissions in the home folder so that every user's folder has the permissions USER=[the name of the user's folder, usually the username itself] GROUP=ADMINISTRATOR MOD=user-read,write,execute; group-read,write,execute; everyoneElse=none;

Basically, any ADMINISTRATOR (you can change that to whatever admin group you have) will have access to all user files, and each USER will have full access to their files.


AGAIN, I can't stress this enough....I REALLY DON'T RECOMMEND THIS AS LONG TERM SOLUTION

Only use this short-term and seek more help to fix the problem finally either on this forum, another one, or on Zentyal's own forum pages.

Last edited by derekpock; 04-03-2016 at 07:49 PM.
 
Old 04-04-2016, 01:58 PM   #10
fomindn
LQ Newbie
 
Registered: Mar 2016
Location: Khmelnitsky, Ukraine
Distribution: Ubuntu 14.04.4 LTS Gnome
Posts: 2

Rep: Reputation: Disabled
Thanks, Derekpock, for your answer!

Very strange what this problem is actual for this time yet and Zentyal developers dont fix it. I was write the same post on the Zentyal forum, but dont receive any answer yet.

In my situation, the domain server on Zentyal will work in small company (about 20 users) and i can setup needed permissions one's by manual after create all users of domain. And then, if new created sub folders in users home folders will have wrong owners (and/or permissions), i plan to create shell script which will start by cron task every 5-15min and change owners.
 
Old 04-04-2016, 02:52 PM   #11
derekpock
Member
 
Registered: Apr 2012
Location: USA
Distribution: Elementary OS Luna
Posts: 83

Original Poster
Rep: Reputation: 4
Sounds reasonable, but I would, in that shell script, only change the perms if they need to be changed. IE, check whether the perms are set correctly before changing them constantly.
 
  


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
Some folders created in Samba share get nobody as owner, rather than forced user anon091 Linux - Server 0 12-07-2013 07:45 PM
[SOLVED] How can any user remove a file created by other user with all permissions(777)? omegazafer Linux - Desktop 5 06-28-2013 02:31 AM
how to set the new user created right as admins in linux 7.3 ? melvinong Linux - Server 2 04-15-2008 07:45 AM
Can you make any files and folders created within a directory owned by another user?? helptonewbie Linux - Newbie 13 12-14-2007 04:21 PM
view folders as root without read permissions cad Linux - General 3 01-30-2007 01:19 AM

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

All times are GMT -5. The time now is 06:45 PM.

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