LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-25-2009, 08:44 AM   #1
dysons
LQ Newbie
 
Registered: Jun 2009
Posts: 2

Rep: Reputation: 0
Restrict File Access


I need to create e different folders Chunk1, Chunk2 and Chunk3. I then want to have 3 different scripts (or even better one script with 3 different options), the options being...

1) Allow RW access to Chunk1, RO access to Chunk2
2) Allow RW access to Chunk2, RO access to Chunk1
3) Allow RW access to Chunk3, RO access to Chunk2

This is because I will be developing software with one of 3 hats on and I don't want to inadvertently access/edit the wrong file!

Is this easy to do?

Thanks,
Steve.
 
Old 11-25-2009, 08:54 AM   #2
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,362

Rep: Reputation: 171Reputation: 171
Probably much easier to just make three users (one for each hat) and assign each user to a group with the appropriate permissions.
 
Old 11-25-2009, 10:01 AM   #3
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
So the script would be run as you start work on each project?

Yeah, as lazlow suggested, you could do this with three different users and "su" between them.

Or, you could just "chmod -w", "chmod +w" as desired in your script. It could take the argument of the RW set and act appropriately.

Something like

Code:
if [ $1 = "Chunk1" ]
then
  chmod -R +w Chunk1/*
  chmod R -w Chunk2/*
and so on.
 
Old 11-25-2009, 05:37 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,287

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
Yeah, 3 groups/dirs, then use 'newgrp' http://linux.die.net/man/1/newgrp to change your current primary group on demand.
 
Old 11-26-2009, 01:24 PM   #5
dysons
LQ Newbie
 
Registered: Jun 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Done!

Thanks for the advice.

Ended up reading through bash script manual and writing a little addition to an existing logon script that calls chmod for aech combination. Seems to work fairly effectively.

I now need to set up 3 eclipse c++ projects (one for each chunk) so that I can edit the source code appropriate to the current 'hat' I am wearing! Not sure how eclipse is going to like to being able to access one of its project areas.

Thanks again.
Steve.
 
  


Reply

Tags
access, file, scripts


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
How do I capture a file-->open command and restrict the path of access PhloxLot Programming 2 08-03-2009 10:03 PM
How to restrict simultaneous multiple access to a common file squirrel001 Linux - Newbie 2 06-17-2008 12:13 PM
Apache Restrict ALL access to file from web blizunt7 Linux - Security 2 08-15-2007 02:08 PM
Restrict X server access using /etc/security/access.conf anand_kt Linux - General 0 04-22-2005 08:40 AM
restrict file access loocw General 0 03-07-2001 12:37 AM


All times are GMT -5. The time now is 10:52 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration