+ Post New Thread
Results 1 to 13 of 13
Mac Thread, Mac OS X: Mapped Home Drives in Technical; Hi there, As we (hopefully) all know, when your OS X client is joined to AD it will automatically map ...
  1. #1

    Join Date
    Jan 2008
    Location
    UK
    Posts
    78
    Thank Post
    5
    Thanked 6 Times in 6 Posts
    Rep Power
    15

    Mac OS X: Mapped Home Drives

    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

  2. #2
    Carter's Avatar
    Join Date
    Sep 2010
    Location
    Canada
    Posts
    269
    Thank Post
    10
    Thanked 66 Times in 41 Posts
    Rep Power
    19
    Check a few posts down, same topic. Trying to get this one working myself.


  3. #3

    Join Date
    Jan 2008
    Location
    UK
    Posts
    78
    Thank Post
    5
    Thanked 6 Times in 6 Posts
    Rep Power
    15
    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.

  4. #4
    Carter's Avatar
    Join Date
    Sep 2010
    Location
    Canada
    Posts
    269
    Thank Post
    10
    Thanked 66 Times in 41 Posts
    Rep Power
    19
    Quote Originally Posted by tomdawson View Post
    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.


  5. #5

    Join Date
    Jan 2008
    Location
    UK
    Posts
    78
    Thank Post
    5
    Thanked 6 Times in 6 Posts
    Rep Power
    15
    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

  6. #6

    Join Date
    Jan 2006
    Posts
    22
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by tomdawson View Post
    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.

  7. #7

    Join Date
    Jan 2008
    Location
    UK
    Posts
    78
    Thank Post
    5
    Thanked 6 Times in 6 Posts
    Rep Power
    15
    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...!

  8. #8

    Join Date
    Jan 2006
    Posts
    22
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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:

    Code:
    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.

    Code:
    #/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.
    Last edited by MouseAT; 15th October 2010 at 11:23 AM.

  9. #9

    Join Date
    Jan 2006
    Posts
    22
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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.
    Code:
    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.

    Code:
    #/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.

  10. #10
    DMcCoy's Avatar
    Join Date
    Oct 2005
    Location
    Isle of Wight
    Posts
    3,451
    Thank Post
    10
    Thanked 493 Times in 433 Posts
    Rep Power
    111
    Should have just created the .TemporaryItems folder at the root of the share, would have been simpler!

  11. #11

    Join Date
    Jan 2006
    Posts
    22
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    The .TemporaryItems folder was there, and was writeable by the users. It didn't make the slightest bit of difference for us.

  12. #12

    Join Date
    Jan 2008
    Location
    UK
    Posts
    78
    Thank Post
    5
    Thanked 6 Times in 6 Posts
    Rep Power
    15
    Quote Originally Posted by MouseAT View Post
    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.

    Quote Originally Posted by DMcCoy View Post
    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?

  13. #13
    DMcCoy's Avatar
    Join Date
    Oct 2005
    Location
    Isle of Wight
    Posts
    3,451
    Thank Post
    10
    Thanked 493 Times in 433 Posts
    Rep Power
    111
    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

SHARE:
+ Post New Thread

Similar Threads

  1. Hiding mapped drives paths (Home folders)
    By bewlay51 in forum Windows Server 2008 R2
    Replies: 6
    Last Post: 14th May 2012, 01:56 PM
  2. Mapped Home Drives in School, But not for home
    By stevenwba in forum Windows
    Replies: 6
    Last Post: 6th May 2010, 09:59 PM
  3. mapped drives
    By silver in forum Hardware
    Replies: 2
    Last Post: 7th January 2009, 01:35 PM
  4. Mapped Drives - not so mapped!
    By LeonieCol in forum Windows
    Replies: 18
    Last Post: 12th March 2008, 03:36 PM
  5. Replies: 4
    Last Post: 7th December 2005, 08:09 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •