LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   home directories based on group membership (http://www.linuxquestions.org/questions/linux-server-73/home-directories-based-on-group-membership-890912/)

freakyal 07-10-2011 09:14 AM

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

Thor_2.0 07-10-2011 04:40 PM

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

freakyal 07-11-2011 05:33 AM

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

Thor_2.0 07-11-2011 05:47 AM

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?

freakyal 07-11-2011 08:18 AM

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

repo 07-11-2011 08:38 AM

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

freakyal 07-11-2011 09:05 AM

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

repo 07-11-2011 09:11 AM

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

freakyal 07-13-2011 12:22 AM

Thank you for your replies. I'll play with the script when I have time.

Cheers,
Al


All times are GMT -5. The time now is 11:16 AM.