Mac OSX auto mount user's network drive

Post November 26th, 2007, 11:13 pm

hm..i dont recall whether or not the afp protocol needs to be enabled on the server, but either using smb or afp you as long as the user is logged on with an AD user account he/she shouldn't need to reauthenticate.. i.e. after logging on, if you go to connect to server and type: smb://your-server-address/folder OR afp://your-server-has-afp-enabled/folder it should bring up that folder without requiring authentication
Image
"In a world without walls and fences, who needs Windows and Gates?"
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 26th, 2007, 11:13 pm

  • gutter
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jul 23, 2007
  • Posts: 5
  • Status: Offline

Post December 4th, 2007, 2:38 pm

Here's the general way to solve the problem. Open up the terminal and use mount to mount a specified users home folder. Once you've figured out how to do that from the command line try making a script to do it automatically, substituting $1 for the user name. Finaly, once you have that working, drop your script into your login hook and enjoy.

There is one very important thing that you have to remember however, the mount command will not automatically grab the users password from anywhere. If you're trying to circumvent the normal network user login process (I'm a longtime proponent of OSX and I'll be the first to start bitching about how broken it is) you will have to get the user to type in their password somewhere and use that to mount their server share.

Good luck.

Post December 4th, 2007, 7:41 pm

In my case, where the Mac was joined to AD and a network share was being mounted after login, AD credentials were not required to be provided after the user had logged in with their AD account.
Image
"In a world without walls and fences, who needs Windows and Gates?"
  • anilth
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Nov 15, 2007
  • Posts: 6
  • Status: Offline

Post February 20th, 2008, 9:02 am

Hello Anarch,

Sorry for late reply but my mounting things are sorted according to your suggestion. Now here i am with another issue. I want to add the printer with script authentication against AD.

I am just thinking to create some script to do this. Ask user to download whenever they like and run it - supply the password and use the printer. is there any method to do this - or apple script would be fine too.

Thanks

Post February 20th, 2008, 10:19 am

that one i'm at a loss on.. someone more knowledgeable in the osx/applescript area will need to take the lead (O_o)
Image
"In a world without walls and fences, who needs Windows and Gates?"
  • rlindenf
  • Born
  • Born
  • No Avatar
  • Joined: Jul 21, 2008
  • Posts: 1
  • Status: Offline

Post July 21st, 2008, 9:04 am

Hello-

Based on what I've read, I'm trying to mount afp drives on user login. What I've done so far:

created a shell script:

Code: [ Download ] [ Select ]
#!/bin/sh

mkdir /Volumes/Users
/sbin/mount -t afp afp://$1@servername/Users /Volumes/Users
  1. #!/bin/sh
  2. mkdir /Volumes/Users
  3. /sbin/mount -t afp afp://$1@servername/Users /Volumes/Users


these commands, minus the /sbin, work from the command line. However, they do not work as a shell script when given:

Code: [ Download ] [ Select ]
sudo chown <filename>
sudo chmod 700 <filename>
  1. sudo chown <filename>
  2. sudo chmod 700 <filename>


and run via

Code: [ Download ] [ Select ]
sudo ./<filename>


nor do the run when passed to the loginwindow via:

Code: [ Download ] [ Select ]
sudo defaults write com.apple.loginwindow LoginHook /path/to/script


the error I get is:

Code: [ Download ] [ Select ]
mount_afp: the mount flags are 0000 the altflags are 0020
mount_afp: AFPMountURL returned error -5002, errno is -5002
  1. mount_afp: the mount flags are 0000 the altflags are 0020
  2. mount_afp: AFPMountURL returned error -5002, errno is -5002


does anyone know what I'm doing wrong?

thanks!

Ralph

Post November 17th, 2008, 12:26 am

Nice work Ralph... keep it up!!!
  • JustDana
  • Born
  • Born
  • No Avatar
  • Joined: Aug 12, 2009
  • Posts: 2
  • Status: Offline

Post August 12th, 2009, 7:44 am

I know this is an old thread but "ADmitMAC" is a great program that integrates macs into a AD/windows environment. you can easily map SMB/AFS drives to any type of a server. Currently we are only mapping to server 2003 soon 2008 and maybe soon OSX server.

http://www.thursby.com/products/admitmac.html

You can setup the mapping for the drives for anyone who logs into said mac.

===============================================

AnarchY SI wrote:
In my case, where the Mac was joined to AD and a network share was being mounted after login, AD credentials were not required to be provided after the user had logged in with their AD account.
  • moonmonkey
  • Born
  • Born
  • No Avatar
  • Joined: Oct 28, 2009
  • Posts: 1
  • Status: Offline

Post October 28th, 2009, 5:40 am

I'm having a similar problem to anilth here.

I've created my login hook and it runs when a user login but it does not mount the network share. After checking the console I find I get this error.


com.apple.loginwindow[33] mount: exec /usr/sbin/mount_smb for /Volumes/resources$: No such file or directory

my script goes like this.

#!/bin/bash

mkdir /Volumes/resources$
/sbin/mount -t smb smb://username:password@bcsfs1/resources$ /Volumes/resources$

This should work fine, I've also found I get the No such file or directory error when I run the command minus the /sbin in Terminal. The most annoying thing about this is if I goto the Connect To Server window in Finder and put in those details then the network share mounts fine. Is there something wrong with the syntax? Or is there something wrong with mounting the volume. I don't know

Obivously I would much rather have the drive auto mount when the computers logs in rather than have users press Command + K and have them type in a path.

Any help would be great!

Cheers!

Post Information

  • Total Posts in this topic: 24 posts
  • Users browsing this forum: No registered users and 19 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.