Jump to content

Recommended Posts

Posted

Hi there,

 

As we (hopefully) all know, when your OS X client is joined to AD it will automatically map the user's home drive, usually on the dock. This is great and works just fine, but the 'local' user home drive is also available. And as OS X will default to the local home drive when attempting to save work, we are going to end up with work saved on the Macs and not onto the home drives.

 

So, I'm wondering, is there a way to have the OS X home drive redirected to a network share? Just in the same way that you can right-click My Documents and change the target location, can the same be done with OS X?

 

Any suggestions would be handy, even if it's "duuh- it's under bla in WGM".

 

Thanks in advance :)

 

OS X 10.6 Server and OS X 10.6 Clients, plus WGM 10.6.3

Posted
Not entirely sure if this is of use to anyone else, but I have made it work by un-checking "Force local home directory on startup disk" in the advanced options of the Directory Utility and that seems to do the trick.
Posted
Not entirely sure if this is of use to anyone else, but I have made it work by un-checking "Force local home directory on startup disk" in the advanced options of the Directory Utility and that seems to do the trick.

 

This works but makes the network drive your home folder. At least when I last tested this last week it was :)

 

The issue with this is that the desktop, downloads etc. folders are all in this location. The last thing I need is a student downloading a movie, files etc. that are really big and they are constantly uploading/downloading on the network, even if they delete the files later this is a lot of network traffic.

 

Posted

Hi, me again. Posting on here again so I'm not accused of cluttering up the forum! Kind of related to home drives, as far as I can work out anyway.

 

We have Office 2004 for Mac installed on our clients (test clients until the new image is rolled out everywhere). I cannot get my head around why this is, but some users are unable to save work to their home drives from any Office application. Saving from the OS, from iLife and from Adobe CS4 applications is fine. But if you try and save from Office 2004 apps, it says that the drive is either full or there's a permissions problem... Well there isn't. That user has read/write access to his user area and as proved with other applications, saving is fine.

 

Some posts online have said that there needs to be some folders in place before you can save (.Trash, .TemporaryItems for example) but I cannot see any reason why a user would not have permissions to create such folders if they were required. I temporarily allowed student and staff users access to run Console, but I could not see any useful entries whatsoever.

 

For info - OS X 10.6 SL clients with OS X 10.6 SL server, bound to CC3 Active Directory domain, home drives automatically mapped to user share (smb://server01.school.internal/username$/)

 

Any clues welcomed!

 

Many thanks :)

Posted
We have Office 2004 for Mac installed on our clients (test clients until the new image is rolled out everywhere). I cannot get my head around why this is, but some users are unable to save work to their home drives from any Office application. Saving from the OS, from iLife and from Adobe CS4 applications is fine. But if you try and save from Office 2004 apps, it says that the drive is either full or there's a permissions problem... Well there isn't. That user has read/write access to his user area and as proved with other applications, saving is fine.

 

Yes, Office breaks when you do this. 2008 has the same problem when using the legacy document formats (DOC, XLS, PPT) although the newer formats (DOCX etc.) seem to be fine.

 

In the end, I left the "Force local home directory on startup disk" enabled, then ran a login script to delete the documents, pictures, music, videos and downloads folders from the local user profile, replacing them with Symlinks to the mounted network volume. This essentially redirects these folders for the user, so that when they log in, all their applications default to saving in their network My Documents/My Music/My Pictures folders. The benefit to doing this is you can choose to only redirect certain folders. On our system, for example, Library and Desktop remain local.

Posted
Seems to make sense. How on earth would I go about doing that? I've found the stuff about adding in the ManagedApp stuff to WGM to modify/create symbolic links but I'm afraid I'm a little bit stumped from this point. How can I tell it to use the network home path apart from using smb://server01/username$ - this obviously needs to pull the network home from AD, I don't want to hard-code for each user or indeed use 'smb://server01/%@$/' to map the directory as our users are spread across four servers.. Any suggestions? Apologies if my rambling makes no sense...!
Posted (edited)

If you have the home directory set in AD, you can read the attribute with a terminal command, but it'll be in windows format ie. \\servername\sharename\path\homedirectory. You'll need to do some regular expression work to convert the path into a mac-style path ie /volumes/sharename/path/homedirectory.

 

Try running the following command as a user and see if it returns the home directory path. If so, you're golden:

 

dscl /Active\ Directory/All\ Domains -read /Users/$USER SMBHome | grep \\\\\\\\.* -o

 

I do this in three stages - I extract the windows formatted path from AD, replace the server name with /volumes/, then replace all remaining backslashes with forward slashes.

 

I'll post my script below for reference but it'll need some tweaking as mine is hard-coded to expect a server name of FS01 or FS02.

 

There are a lot of backslashes in the script - most of them are escape characters, but I've tried to explain in the comments how many backslashes (in the script) represent a single one in the string.

 

#/bin/bash

#Read the Windows formatted SMB path to the user's home directory
#Stores only the URL string from \\ onwards
#Note that four backslashes represent a single backslash here
WinFormattedDirectory=`dscl /Active\ Directory/All\ Domains -read /Users/$USER SMBHome | grep \\\\\\\\.* -o`

#If AD fails to return a path to the user space, don't proceed as we don't want to break the user's documents folder
#This is particularly important if the user is logged in as a local user
if [ $? -eq 0 ]
then
   #Replace the server name \\FS0[0-9] from the start of the string with /Volumes to give us the share name and path
   #Note that eight backslashes represent a single backslash here
   ShortenedWinFormattedDirectory=`echo $WinFormattedDirectory | sed s/\\\\\\\\\\\\\\\\fs0[0-9]/\\\\/Volumes/`

   #Replace all backslashes with forward slashes
   #Note that eight backslashes represent a single backslash here
   MacFormattedDirectory=`echo $ShortenedWinFormattedDirectory | sed s/\\\\\\\\/\\\\//g`

   #Change permissions on local documents folder so that we can delete it
   chmod -R -N ~/Documents

   #Remove the local Documents folder
   rm -rf ~/Documents

   #Create a SymLink to the network documents folder
   ln -s $MacFormattedDirectory ~/Documents

   #Create Downloads directory in network My Documents folder if it doesn't already exist
   mkdir ~/Documents/Downloads

   #Change permissions on local Downloads folder so that we can delete it
   chmod -R -N ~/Downloads

   #Remove the local Downloads folder
   rm -rf ~/Downloads

   #Create a SymLink to the network Downloads folder
   ln -s ~/Documents/Downloads ~/Downloads

   #Create My Videos directory in network My Documents folder if it doesn't already exist
   mkdir ~/Documents/My\ Videos

   #Change permissions on local Movies folder so that we can delete it
   chmod -R -N ~/Movies

   #Remove the local Movies folder
   rm -rf ~/Movies

   #Create a SymLink to the network My Videos folder
   ln -s ~/Documents/My\ Videos ~/Movies

   #Create My Music directory in network My Documents folder if it doesn't already exist
   mkdir ~/Documents/My\ Music

   #Change permissions on local Music folder so that we can delete it
   chmod -R -N ~/Music

   #Remove the local Music folder
   rm -rf ~/Music

   #Create a SymLink to the network My Music folder
   ln -s ~/Documents/My\ Music ~/Music

   #Create My Pictures directory in network My Documents folder if it doesn't already exist
   mkdir ~/Documents/My\ Pictures

   #Change permissions on local Pictures folder so that we can delete it
   chmod -R -N ~/Pictures

   #Remove the local Pictures folder
   rm -rf ~/Pictures

   #Create a SymLink to the network My Pictures folder
   ln -s ~/Documents/My\ Pictures ~/Pictures
fi

 

Whatever you do, don't invoke this script from an AppleScript - it'll break spectacularly as AppleScript expects yet more backslashes to escape characters. I used a utility called Platypus to build an App package containing the script (which doesn't appear in the dock and closes once it completes), and then just run that App at logon. This avoids the user being left with a visible, running instance of terminal once the script completes.

 

I hope this makes vague sense.

Edited by MouseAT
Posted

If you have the home directory set in AD, you can read the attribute with a terminal command, but it'll be in windows format ie. \\servername\sharename\path\homedirectory. You'll need to do some regular expression work to convert the path into a mac-style path ie /volumes/sharename/path/homedirectory.

 

Try running the following command as a mac user and see if it returns your home directory. If so, you're golden. If not, you'll have to figure out how to query AD for group memberships, profile locations etc. on your own and build the path string yourself.

dscl /Active\ Directory/All\ Domains -read /Users/$USER SMBHome | grep \\\\\\\\.* -o

 

I do this in three stages - I extract the windows formatted path from AD, replace the server name with /volumes/, then replace all remaining backslashes with forward slashes.

 

I'll post my script below for reference but it'll need some tweaking as mine is hard-coded to expect a server name of FS01 or FS02.

 

There are a lot of backslashes in the script - most of them are escape characters, but I've tried to explain in the comments how many backslashes (in the script) represent a single one in the string.

 

#/bin/bash

#Read the Windows formatted SMB path to the user's home directory
#Stores only the URL string from \\ onwards
#Note that four backslashes represent a single backslash here
WinFormattedDirectory=`dscl /Active\ Directory/All\ Domains -read /Users/$USER SMBHome | grep \\\\\\\\.* -o`

#If AD fails to return a path to the user space, don't proceed as we don't want to break the user's documents folder
#This is particularly important if the user is logged in as a local user
if [ $? -eq 0 ]
then
   #Replace the server name \\FS0[0-9] from the start of the string with /Volumes to give us the share name and path
   #Note that eight backslashes represent a single backslash here
   ShortenedWinFormattedDirectory=`echo $WinFormattedDirectory | sed s/\\\\\\\\\\\\\\\\fs0[0-9]/\\\\/Volumes/`

   #Replace all backslashes with forward slashes
   #Note that eight backslashes represent a single backslash here
   MacFormattedDirectory=`echo $ShortenedWinFormattedDirectory | sed s/\\\\\\\\/\\\\//g`

   #Change permissions on local documents folder so that we can delete it
   chmod -R -N ~/Documents

   #Remove the local Documents folder
   rm -rf ~/Documents

   #Create a SymLink to the network documents folder
   ln -s $MacFormattedDirectory ~/Documents

   #Create Downloads directory in network My Documents folder if it doesn't already exist
   mkdir ~/Documents/Downloads

   #Change permissions on local Downloads folder so that we can delete it
   chmod -R -N ~/Downloads

   #Remove the local Downloads folder
   rm -rf ~/Downloads

   #Create a SymLink to the network Downloads folder
   ln -s ~/Documents/Downloads ~/Downloads

   #Create My Videos directory in network My Documents folder if it doesn't already exist
   mkdir ~/Documents/My\ Videos

   #Change permissions on local Movies folder so that we can delete it
   chmod -R -N ~/Movies

   #Remove the local Movies folder
   rm -rf ~/Movies

   #Create a SymLink to the network My Videos folder
   ln -s ~/Documents/My\ Videos ~/Movies

   #Create My Music directory in network My Documents folder if it doesn't already exist
   mkdir ~/Documents/My\ Music

   #Change permissions on local Music folder so that we can delete it
   chmod -R -N ~/Music

   #Remove the local Music folder
   rm -rf ~/Music

   #Create a SymLink to the network My Music folder
   ln -s ~/Documents/My\ Music ~/Music

   #Create My Pictures directory in network My Documents folder if it doesn't already exist
   mkdir ~/Documents/My\ Pictures

   #Change permissions on local Pictures folder so that we can delete it
   chmod -R -N ~/Pictures

   #Remove the local Pictures folder
   rm -rf ~/Pictures

   #Create a SymLink to the network My Pictures folder
   ln -s ~/Documents/My\ Pictures ~/Pictures
fi

 

Whatever you do, don't invoke this script from an AppleScript - it'll break spectacularly as AppleScript expects yet more backslashes to escape characters. I used a utility called Platypus to build an App package containing the script (which doesn't appear in the dock and closes once it completes), and then just run that App at logon. This avoids the user being left with a visible, running instance of terminal once the script completes.

 

I hope this makes vague sense.

Posted
The .TemporaryItems folder was there, and was writeable by the users. It didn't make the slightest bit of difference for us.

 

Likewise.

 

Thanks for the scripts, I will investigate in a bit.

 

Should have just created the .TemporaryItems folder at the root of the share, would have been simpler!

 

I did look at this online, but how would I do so? WGM is picking up their home folder from AD, so it is mapping the home to smb://server.domain.internal/usernameshare$/ for example - do I have to create a share on server.domain.internal called '.TemporaryItems' or do I have to create a .TemporaryItems folder in every single user's home directory?

Posted

The .TemporaryItems folder needs to be under \\Server\Share\.TemporaryItems where the users folder is \\Server\Share\Userfolder

 

Things to try, as I have had to set them here in the past: Folder needs to be owned by domain administrator, not machine administrator. Users need full control over the folder or OS X gets the wrong ugo permissions returned.

 

If you are redirecting your Library/Cache folder to the local Mac drive then this will not work as the TemporaryItems folder must be on the same volume as the saved file. See Re: Problems with Office when redirecting cache for details about that. I use the WGM redirection to send Library/Caches/TemporaryItems to Library/TemporaryItems as that remains on the network.

 

The WGM redirect will create then delete the folder on 10.5 for some reason so I run an apple script app (as a logon item, no need to change settings to get login hooks working then).

 

set HomePath to (path to home folder) as string

set HomeLibrary to (HomePath & "Library" as alias)

 

tell application "Finder"

if not (exists folder "TemporaryItems" of HomeLibrary) then

set CreateTemporaryItems to make new folder at HomeLibrary with properties {name:"TemporaryItems"}

end if

end tell

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...