LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 07-10-2011, 09:14 AM   #1
freakyal
LQ Newbie
 
Registered: Jul 2011
Distribution: FreeBSD, Ubuntu
Posts: 7

Rep: Reputation: Disabled
Question home directories based on group membership


Hi,

If this is already covered than I apologize in advance.

I have recently joined an 11.04 server to an AD and want to configure home directories based on group membership for all AD users that login. Basically, I want one home directory for "Domain Users" and another for "Domain Admins".

Is this a pipe dream or possible?

Cheers,
Al
 
Old 07-10-2011, 04:40 PM   #2
Thor_2.0
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,168
Blog Entries: 23

Rep: Reputation: 275Reputation: 275Reputation: 275
Not impossible...and easily done. I'd provide a symlink to a common folder per user. Package that in a script that wraps useradd, it checks what group (reads the command line) is used and sets up a symlink in the newly made folder of that user.

I suspect a small PERL script should do it...

If need be, I'll meditate on it, but it can be done...

Thor
 
Old 07-11-2011, 05:33 AM   #3
freakyal
LQ Newbie
 
Registered: Jul 2011
Distribution: FreeBSD, Ubuntu
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thor 2.0,

Could the symbolic link replace the existing user's home directory but have the same name? Then the entries in /etc/passwd would still be valid. Access to the new folder would be based on group membership. Is there a way to run it the first time a user logs in?

Cheers,
Al
 
Old 07-11-2011, 05:47 AM   #4
Thor_2.0
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,168
Blog Entries: 23

Rep: Reputation: 275Reputation: 275Reputation: 275
Quote:
Could the symbolic link replace the existing user's home directory but have the same name?
I suspect so, but that would not be very practical. For one, you'll not be able to keep the individual users apart. Each user with its folder, and a symlink in that folder allows you ro keep fine-grained control of the users.

Quote:
Then the entries in /etc/passwd would still be valid.
Well, the way I proposed would satisfy that need...

Quote:
Access to the new folder would be based on group membership. Is there a way to run it the first time a user logs in?
The chmod command already caters for this...I think...

I think you'd be best served with a PERL wrapper around adduser...just how good is your PERL?
 
Old 07-11-2011, 08:18 AM   #5
freakyal
LQ Newbie
 
Registered: Jul 2011
Distribution: FreeBSD, Ubuntu
Posts: 7

Original Poster
Rep: Reputation: Disabled
Unfortunately I have little experience in perl beyond reading scripts to figure out what they do. I have never written anything in perl. I have in shell, python, expect and taken some first level C++ courses.

I am hoping to run it on the user's first login only for obvious reasons.

Thanks for your help,
Al

Last edited by freakyal; 07-11-2011 at 09:01 AM.
 
Old 07-11-2011, 08:38 AM   #6
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Slackware 14.0
Posts: 8,464

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
You can create a group with the same home directory, and add the users to the group.
Here's an example
http://www.cyberciti.biz/faq/linux-s...red-directory/

Kind regards
 
Old 07-11-2011, 09:05 AM   #7
freakyal
LQ Newbie
 
Registered: Jul 2011
Distribution: FreeBSD, Ubuntu
Posts: 7

Original Poster
Rep: Reputation: Disabled
repo,

Would that replace the users' default home directory? If so, could I just make the group an AD group and have it pull membership via winbind?

Thanks for your time,
Al

Last edited by freakyal; 07-13-2011 at 12:21 AM.
 
Old 07-11-2011, 09:11 AM   #8
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Slackware 14.0
Posts: 8,464

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
Since you use
Code:
 useradd -d
you can define the home directory of the user.
Quote:
could I just make the group an AD group and have it pull membership via winbind?
Sorry, no idea, I'm not an expert in AD and winbind.

Kind regards
 
Old 07-13-2011, 12:22 AM   #9
freakyal
LQ Newbie
 
Registered: Jul 2011
Distribution: FreeBSD, Ubuntu
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thank you for your replies. I'll play with the script when I have time.

Cheers,
Al
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Group membership and restrictions IsakovAN Linux - Security 2 12-21-2009 01:37 AM
Apache 2.2 and LDAP Based home directories tpe Linux - Server 0 07-03-2009 08:22 AM
Group Membership Limitations Kdr Kane Linux - Enterprise 1 08-23-2006 02:05 PM
Group membership? KlaymenDK Mandriva 4 06-25-2004 04:10 AM
Group Membership Question rlkiddjr Linux - General 3 06-18-2002 10:26 PM


All times are GMT -5. The time now is 02:32 PM.

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