LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-20-2015, 06:23 PM   #1
jemenake
LQ Newbie
 
Registered: Oct 2003
Posts: 15

Rep: Reputation: 0
Is there a tool to enforce "policies" on folders?


I'd think that some tool exists like this, but I've never heard of anything like it in my travels.

I have a user who habitually saves documents where he shouldn't. His mp3's will show up in a folder where his Word files are supposed to go... he'll have strange files in a folder which is only supposed to house a certain project, YouSendIt files show up in his iTunes folders, etc. I could probably train him more-effectively (and keep things from getting too bad before I could step in to fix things) if I could be alerted as soon as he starts saving stuff in the wrong place.

It dawned on me that I really need a tool which would crawl the filesystem a few times per day looking for files called, say, ".folderpolicy". Within that file, you might see something like:

# Only music files!
ALLOW .mp3 .aif .flac .aac
DENY ALL

- or... you could deny things like sub-folders and symbolic links...
DENY FOLDER SYMLINK


The folder policy would be in effect for all files and folders within and below the folder where .folderpolicy was found until a new .folderpolicy was encountered.

Any violations to the policy could either... email me, put a pop-up in front of the user, whatever.

Is there anything like that already out there?
 
Old 04-20-2015, 06:51 PM   #2
kmhuntly
Member
 
Registered: Mar 2015
Location: Cheektowaga, NY
Distribution: ArchLinux
Posts: 34

Rep: Reputation: 7
I don't know if there's a native utility for this but you could set up a cron job that runs a script that does what you want.. Shouldn't be too difficult to implement.
 
Old 04-20-2015, 08:00 PM   #3
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 726
Blog Entries: 1

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
Quote:
Originally Posted by jemenake View Post
I have a user who habitually saves documents where he shouldn't. His mp3's will show up in a folder where his Word files are supposed to go... he'll have strange files in a folder which is only supposed to house a certain project ...
Slightly confused, so I will assume you are asking about doing this on a Linux type system, so check out:
Code:
man 5 acl
man 1 setfacl
John
 
Old 04-20-2015, 08:16 PM   #4
kmhuntly
Member
 
Registered: Mar 2015
Location: Cheektowaga, NY
Distribution: ArchLinux
Posts: 34

Rep: Reputation: 7
I'm not sure acl's will address the OP's concern. However, I did find this after a google search:

http://unix.stackexchange.com/questi...t-by-file-type

Appears to address the problem, but I skimmed it briefly so not 100 certain.
 
Old 04-20-2015, 09:06 PM   #5
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 726
Blog Entries: 1

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
I think setfacl(1) should work for the OP, for example
Code:
setfacl -m "u:user:---" dirname
will prevent access to Dir "dirname", changing '---' to 'r-x' will give the dir just read access. This assumes the 'global' access (chmod) does not allow access by all users.

The OP will have experiment with settings. I would suggest one should prevent access by everyone and add access to people you want to have read/write access on a per user basis via setfacl(1).

John
 
Old 04-20-2015, 09:10 PM   #6
kmhuntly
Member
 
Registered: Mar 2015
Location: Cheektowaga, NY
Distribution: ArchLinux
Posts: 34

Rep: Reputation: 7
I believe the OP is looking for a way to restrict placement of files in directories based on file type though - e.g. PDF/ houses only PDF files, Documents/ houses only *.doc* files, etc. Locking down access won't achieve that because the offending user would still need access to the directory to perform daily tasks

(Edited - misread permission set)

Last edited by kmhuntly; 04-20-2015 at 09:14 PM.
 
Old 04-21-2015, 04:43 PM   #7
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 726
Blog Entries: 1

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
Quote:
Originally Posted by kmhuntly View Post
I believe the OP is looking for a way to restrict placement of files in directories based on file type though ....
Based upon my initial confusion with the question, you could be right, in that case acl will not work.

Anyway at least the OP has two possible solutions.

John
 
  


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
using 'find' to list "files" or "folders" named with any of three patterns SaintDanBert Linux - Software 3 04-15-2015 10:00 AM
".config" and ".kde" folders are being created under root directory (Slack Current) piratesmack Slackware 8 03-12-2011 11:06 PM
How might I restore kmail folders/mail/settings from a "badly" saved "home"? deh6 Linux - Software 5 03-08-2008 09:25 PM
How do you create shortcuts to "folders" and "binaries" in GNOME? ebenh Linux - Desktop 5 01-21-2008 05:28 AM
Displaying "Subscribed Threads" -> new folder "All Folders" JZL240I-U LQ Suggestions & Feedback 5 06-15-2007 06:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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