Operating System - Linux
1827421 Members
4020 Online
109965 Solutions
New Discussion

customize user acces to specific directory via login profile

 
x2000koh
New Member

customize user acces to specific directory via login profile

Hi ! NIS developer
I am using redhat 8 setup the nis server and client which now they
can talk to each others.

I am trying to work out "the user access to specific directory
based on his login name or login id." Not very strong in shell
script programming. hope anyone can assist.

In /home/amish/jane/.bash_profile how do I let user jane to access to
a specific directory only everytime when he login with his login name.

For example,
jane 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 at user's profile
(/home/amish/jane/.bsh_profile) to let user access
his directory when he login. I can not use fstab because fstab is
specific to the hostname. If user try to access to other computer
within the network then it won't be able to access his department or
specific directory.
I am new to linux programming, I am trying to pick up along
the way.

Appreciate if anyone can help.

Regards,
x2000koh
5 REPLIES 5
Vitaly Karasik_1
Honored Contributor

Re: customize user acces to specific directory via login profile

as far as I see, ownership and group ownership may help here.

for example, you have

/marketing directory with group "marketing" as owner, you allow read/write access for "marketing" group for this directory, and you add all your marketing people to "marketing" group.


Regards,
Vitaly.
Balaji N
Honored Contributor

Re: customize user acces to specific directory via login profile

hi

1. one way is to use the group permissions. all users of marketing belogn to the marketing group, acct users to accounting etc. the most elegant and easiest way

2. another way is to restrict is using restricted bash shell. in the /etc/profile, when the user logins create a links to the directories which u need to give him access inside his home directory. man bash and see the restricted access section.

but tell me one reason why point 1 doesnt work before u proceed with the next. :-)

cheers
-b-
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
x2000koh
New Member

Re: customize user acces to specific directory via login profile

Thanks belanji and vitali for reply to my message.

belanji, point 1 is working fine. I have set the permission for owner, group all that are working.

Now I want to work on user specific access right to his department directory. I just want a user to access his directory when he login. Just like window directory mapping which I can write a batch file. The user id will determine which directory I can access to.

I have read the man bash about the restricted shell but not quite sure how to do it.

Have you heard about NIS netgroup ? I am looking for more information on that.

regards,
x2000koh





Vitaly Karasik_1
Honored Contributor

Re: customize user acces to specific directory via login profile

as far as I see, you just want to provide the same working directory for user from different machines.

NFS (+ symbolic links + automounter) do this work.

You just point user's home directory to NDS directory.

"Managing NIS and NFS" from O"Reily may help you.
Avinoam
Frequent Advisor

Re: customize user acces to specific directory via login profile

hello


the solution is to automount the user directory so when ever the user login it will have this folder mapped as his home folder :

1. install the autofs package
2. edit the file: /etc/auto.master and add the entry :
/home /etc/auto.home --timeout 60

3. creat the file /etc/auto.home and add the following line to it :
* -rw,soft,intr :/home/&

this will map the home folder of your user to the nfs exported home folder.
Sababa