Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4 Server: Another way to mount shares at login OS X Server
Tiger only hintI have read on macosxhints.com about many different ways to mount a network share when a user logs in. Many of them require AppleScripts and editing NetInfo databases, neither of which I was particularly comfortable with.

My method, detailed below, has the added benefit of keeping the username and password out of an AppleScript. To my knowledge, this requires Tiger Server and network/mobile accounts.
  1. Mount a share on the machine where you are running the Server Admin tools via the "Connect to Server" dialog box. It is best that this share be of the same type (AFP v. SMB) and on the same server as the shares that you are planning to assign.
  2. Open up Workgroup Manager and connect to the server where your accounts are located.
  3. Select the user(s) you would like to have automatically mount a share. It is not important that they all are mounting the same share, as we will be editing that later.
  4. Click on Preferences at the top of the window. Make sure that Overview is selected (as opposed to details).
  5. Click on Login in the settings area and then make sure that "Login Items" is selected. Click on "Always."
  6. From here click "Add...," and in the new window, select the share that you have mounted on your machine. Again, it is not important that the share here is the one that you would like to mount for each user. Confirm by clicking the add button. This will return you to the Login Items panel.
  7. At this point, you should see a URL with the path to the share that you mounted on your machine. Select that URL and check the box next to "Mount item with user's name and password." Click "Done" at the bottom and confirm by clicking "Save."
  8. Now you should be back in the Overview panel. (If you are doing a group of accounts, select only the ones that you wish to change before the next step.) This time click "Details," and you should see an entry for loginwindow. Select loginwindow and click Edit. This will drop you into a window similar to the PropertyList Editor in Developer Tools. Option-click on the arrow next to "Always" to automagically open all nested entries.
  9. Edit the URL to your heart's content and save. When the user logs in the next time, this URL will be opened with their username and password.
  10. Repeat for all users necessary.
I have not tested this for SMB shares on Windows Servers, but this works well for the shares on the Tiger servers.
    •    
  • Currently 1.63 / 5
  You rated: 4 / 5 (8 votes cast)
 
[17,410 views]  

10.4 Server: Another way to mount shares at login | 8 comments | Create New Account
Click here to return to the '10.4 Server: Another way to mount shares at login' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4 Server: Another way to mount shares at login
Authored by: fltman on Jan 12, '06 07:25:45AM

I use Reconnector (www.reconnector.com) not only to mount my volumes but also to keep them mounted. Excellent software IMHO.



[ Reply to This | # ]
10.4 Server: Another way to mount shares at login
Authored by: fresler on Jan 12, '06 09:32:23AM

Another software solution is Home and Away (www.maccrafters.com) which will mount volumes and launch applications on login based on which network you are on.



[ Reply to This | # ]
10.4 Server: Another way to mount shares at login
Authored by: xSmurf on Jan 12, '06 10:09:10AM
I've made myself a little shell script to handle that. I then run it every 2 minutes using launchd. It only supports share from one server but it wouldn't be hard to modify that. I suggest you chmod 700 this script as it will hold your login/password in clear text.


#!/usr/bin/env php

<?PHP
$remote_addr	= '169.0.1.2';				// The server's remote address
$afp_share	= array('Mount1', 'Mount2', 'Mount3');	// List your shares
$afp_user	= 'USERNAME';				// Your afp users
$afp_password	= 'PASSWORD';				// Your afp password

if ($argv[1]) $remote_addr = $argv[1];

exec('ping -t 1 -c 1 '.$remote_addr, $exec_ping);

if (!strpos(implode('', $exec_ping), '100% packet loss')) {
	for ($i = 0;$i<count($afp_share);$i++) {
		if (!is_dir('/Volumes/'.$afp_share[$i])) {
			exec('mkdir /Volumes/'.$afp_share[$i]);
			exec('mount_afp afp://'.$afp_user.':'.$afp_password.'@'.$remote_addr.'/'.$afp_share[$i].' /Volumes/'.$afp_share[$i]);
			exec('umask 022 /Volumes/'.$afp_share[$i]);
			exec('disktool -r');
			echo date("Y-m-d G:i:s")." - CheckAFP: Mounting AFP Share {$afp_share[$i]} @ {$remote_addr}\n";
		} else {
			//echo "AFP Share: '{$afp_share[$i]} @ {$remote_addr}' already mounted\n";
		}
	}
}
exit(0);
?>

---
SnitchCTL : http://snitchctl.smurfturf.net/

PM G4 DP 800 / 1.25gb / 120Gb+80Gb / CD/DVD±RW/RAM/DL
- The only APP Smurf

[ Reply to This | # ]

10.4 Server: Another way to mount shares at login
Authored by: iordonez on Jan 12, '06 10:19:21AM

God I hope that anyone running a copy of OS X Server should know about this... Seriously, I'm scared of some people who end up administering a server.



[ Reply to This | # ]
10.4 Server: Yet Another way to mount shares at login
Authored by: andrus on Jan 12, '06 11:35:06AM

For those who access certain folders on a server regularly, one can just drag the folder to the dock. It does not mount automatically on login, but when the dock folder icon is selected, the folder will open in a finder window after automatically mounting the share.

To make this work, You have to login to the server and make sure the Remember Password in Keychain box is checked. You then navigate to the folder you want to open. (Do not actually open the folder just yet, just get it so you can get your hands on it.) Drag that folder to the dock and the next time you boot up your machine, all you will have to do is to select the folder icon in the dock to mount the server and open the folder in a finder window.



[ Reply to This | # ]
10.4 Server: Another way to mount shares at login
Authored by: iamdw on Jan 12, '06 01:19:55PM

I've managed apply a similar method using a client computers User's account prefpane login items.

The steps are nearly identical with the only difference being the process is done on the client machine with the shares on a Mac Os X 10.4.4 server box and a plain old Dell Dimension 4700:

  • Mount the shares (in my case AFP stylee from Tiger Server and SMB from Dell) on the client machine, and make sure you tick all the "remember my authentication whatnots".
  • Open up the Accounts Prefpane and drag the shares into the pane
  • Quit the System Preferences app

I've successfully been able to mount both the Tiger Server AFP shares as well as the Dell SMB shares. This seems almost too easy, but hey, i'm on a Mac so…

Please let me know if you're having any trouble getting this to work.

hope to help,
-dDub

[ Reply to This | # ]
10.4 Server: Another way to mount shares at login
Authored by: sjk on Jan 12, '06 11:12:39PM

Can you clarify step 2? Does it mean to drag icons for network-mounted volumes/folders into the Login Items tab for a user's Accounts preferences? That works but I haven't done a logout/login cycle to test if it mounts.



[ Reply to This | # ]
10.4 Server: Another way to mount shares at login
Authored by: sjk on Jan 12, '06 11:18:53PM

Ignore my post. I just re-read the first sentence of yours and got the answer.



[ Reply to This | # ]