AutoMapping network drive per user login

tylerwardtech

Junior Member
Feb 15, 2012
7
0
0
Hello,

We are using Active Directory to map a unique drive to each user for our windows computers. In essence, if Joe Smith logs in, he automatically gets a drive mapped to him that points to \\file\staff\jsmith. If Jane Doe logs on, she gets one that points to \\file\staff\jdoe.

As I am not to familiar with Macs, my wording may be a little off. We have some Macs that log on to AD but do not get those user specific drives mapped to their account. I know how to map a drive for each user by logging on as them, connecting to the server, then putting that path in the "login items" in the accounts section. Is there a way to edit some startup script that tells the computer to map a certain drive if a certain person logs on?
 

qft

Member
Feb 22, 2012
41
0
0
Been a couple years but you might want to see if there's a way to manipulate the saved network places (open apple K).
 

tylerwardtech

Junior Member
Feb 15, 2012
7
0
0
Been a couple years but you might want to see if there's a way to manipulate the saved network places (open apple K).

By the sound of your response it seems that each user would have already had to have logged on to the system before. I would like a "script" or something to run each time anybody logs on, to map their user specific folder.
 

postaled

Senior member
Feb 20, 2007
254
0
0
I know that its possibly to has OS X automatically mount your home folder from active directory. I am not sure what all we had to setup to get that working either.

I probably won't have any time in the next few days but maybe once I do have time I can check it out.
 

lokiju

Lifer
May 29, 2003
18,526
5
0
Go to settings and then open "Users & Groups" unlock (click lock on bottom left and authenticate). right click (or hold control and left click) on the user and click on "Advanced Options". Change the users home directory to the desired path.

Also you can bind a Mac to Active Directory. That has to be done under the "Directory Utility" app, which is somewhat hidden.

You can find that here. /System/Library/CoreServices/Directory Utility.app

I'm a system admin/engineer and one place I was working last year had a large mix of Windows and Macs and I've done this for the same need/desire to have a network home directory.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Go to settings and then open "Users & Groups" unlock (click lock on bottom left and authenticate). right click (or hold control and left click) on the user and click on "Advanced Options". Change the users home directory to the desired path.

Also you can bind a Mac to Active Directory. That has to be done under the "Directory Utility" app, which is somewhat hidden.

You can find that here. /System/Library/CoreServices/Directory Utility.app

I'm a system admin/engineer and one place I was working last year had a large mix of Windows and Macs and I've done this for the same need/desire to have a network home directory.

So you really have to touch every single Mac?
 

tylerwardtech

Junior Member
Feb 15, 2012
7
0
0
I know that its possibly to has OS X automatically mount your home folder from active directory. I am not sure what all we had to setup to get that working either.

I probably won't have any time in the next few days but maybe once I do have time I can check it out.

That would be great. It seems all the other solutions were that I had to configure each Mac separately. As you know that would be very time consuming. Also another solution would be to have the users map their own drive. But a lot of our users are young children, which makes it harder. I am not a prorammer by all means, but from what I've read you can create a "login hook" which points to a script which will run at every login. Yes, i would have to put that "hook" or script on every Mac, unless there is a way to push it out. We also have been looking in the Apple Remote Desktop, but we have less then 100 Macs so the price seems a little high for that amount.

Thanks
 

alfa147x

Lifer
Jul 14, 2005
29,307
106
106
That would be great. It seems all the other solutions were that I had to configure each Mac separately. As you know that would be very time consuming. Also another solution would be to have the users map their own drive. But a lot of our users are young children, which makes it harder. I am not a prorammer by all means, but from what I've read you can create a "login hook" which points to a script which will run at every login. Yes, i would have to put that "hook" or script on every Mac, unless there is a way to push it out. We also have been looking in the Apple Remote Desktop, but we have less then 100 Macs so the price seems a little high for that amount.

Thanks

You might be eligible for a edu discount. I would call Apple
 

tylerwardtech

Junior Member
Feb 15, 2012
7
0
0
I've made a small script that says:

mount volume "smb://file1/shared"
mount volume "smb://file2/students/$USER"

I've entered the command:

sudo defaults write com.apple.loginwindow LoginHook /path/to/script

This command is supposed to edit the "login script" for everyone so it executes the script. It is only working for "managed" accounts. It is not working for "managed, mobile" accounts. Anybody have any ideas to make it work?

Also, in windows you can place stuff in the c:\documents and settings\all users\desktop and it will display on any users desktop that logs on. If you place an application in the "\all programs\startup" folder, that app will run at each login. Are there folders like that on Mac OSX?
 

PCTC2

Diamond Member
Feb 18, 2007
3,892
33
91
To automount SMB home directories, you have to do a few things.

1) Create the attribute or mapping in AD for Mac for user home directories to exist in /home
2) Modify /etc/auto_master so it includes a line:
/home auto_home -nobrowse,hidefromfinder,nosuid
3) Create a file ( or modify ) /etc/auto_home and add the line:
* -fstype=smbfs ://<username>:<password>@<servername>/<share>/&

For example, users on the remote server are stored in a share called "home" and exist as "home/user1", then the end would be <servername>/home/&

4) Run 'sudo automount -cv'

And you're done. As long as your user home directories map to /home/<username>, then when they log in, it will try to mount smb://<server>/<share>/<username> on /home/<username>.

Note: The <username>:<password> part is if you require a username and password for your SMB share. HOWEVER, this would be saving it in a flat txt file, which is bad security practice. If it mounts without a password, then this would be better. Then, just omit "<username>:<password>@"