Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-25-2009, 08:44 AM   #1
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?

Old 11-25-2009, 08:54 AM   #2
Senior Member
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
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
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

if [ $1 = "Chunk1" ]
  chmod -R +w Chunk1/*
  chmod R -w Chunk2/*
and so on.
Old 11-25-2009, 05:37 PM   #4
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,377

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

Original Poster
Rep: Reputation: 0

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.


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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:27 AM.

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