LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-21-2003, 01:08 AM   #1
x2000koh
Member
 
Registered: Jul 2002
Location: singapore
Distribution: red had 7.2
Posts: 109

Rep: Reputation: 15
user acess spacific to a directory using bash how to


Hi ! Linux expert
I am using redhat 8. I have setup nis Client and Server.
In /etc/profile (/etc/bashrc) how do I let a specific user access to a specific directory only everytime when he login with his login name.

For example,
User can access to his directory on any client machines in the network. Their access right (to access the directory) is depend on the user login name or UID. user_sales can only access to marketing directory. whereas, User_casher can only access to accouting directory.

I have setup the following in my nis server to make it available to other clients to share.
etc/exports
/home/accounting
/home/marketing

How can I write a program in /etc/profile (/etc/bash) to let user access his directory when he login. I am new to linux programming, I am trying to pick up along the way.

Appreciate if anyone can help.

Regards,
x2000koh

Last edited by x2000koh; 07-21-2003 at 01:21 AM.
 
Old 07-21-2003, 08:59 PM   #2
slapNUT
Member
 
Registered: Jun 2001
Location: Recycle Bin
Distribution: Linux & Everything else on VirtualBox
Posts: 144

Rep: Reputation: 15
I think you need to assign the user a "restricted shell". I'm sure it is covered in man bash but if you edit /etc/passwd for each machine the user might login on and make the shell /bin/bash -r I think this will do it.

<edit> Of course I'm assuming you have already set their home directory to either /home/accounting or /home/marketing

Last edited by slapNUT; 07-21-2003 at 09:01 PM.
 
Old 07-21-2003, 10:34 PM   #3
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 392

Rep: Reputation: 55
I've never used NIS, so you might have to modify the following accordingly.

You could do it by:
- adding groups using groupadd(8) called "accounting" and "marketing".
- Make the group owner of /home/accounting and /home/marketing the appropriate group.
- Turn on the Set Group ID (SGID) bit on the /home/accounting and /home/marketing so the files created there will have the appropriate group ownership.
- Turn off the permission bits that allow "others" into the directories.
- Add the appropriate users to the appropriate groups.

Wow, I sure used the word "appropriate" a lot!

Does this meet your requirements?

Lyle
 
  


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
How can i acess like super user...? Khmer Slackware 13 08-13-2005 09:39 AM
[bash] locating script's directory Erhnam Programming 19 02-01-2005 03:45 AM
bash: cd: My: No such file or directory Doug.Gentry Fedora 2 12-05-2004 02:53 PM
bash: su - changes directory to /root arpi Linux - Software 2 06-11-2004 08:19 PM
Link user directory according to user id x2000koh Programming 1 07-24-2003 06:38 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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