+ Post New Thread
Results 1 to 11 of 11
Mac Thread, Another how to map a windows share thread ! in Technical; Hello, I have what I thought would be an easy problem to solve but it has turned out to be ...
  1. #1
    richardp's Avatar
    Join Date
    May 2007
    Location
    North Yorkshire
    Posts
    131
    Thank Post
    3
    Thanked 25 Times in 25 Posts
    Rep Power
    19

    Another how to map a windows share thread !

    Hello,

    I have what I thought would be an easy problem to solve but it has turned out to be a bit more complicated (unless I am missing something!).


    We have decided to buy 16 new iMacs, infact we have already ordered them. However the powers that be have not allocated any money for a OS X server. Assuming we continue to get a decent level of capital funding next year we will buy one then. However until then I need to get the iMacs to work with our 2003 server. I have had a macbook pro for a while now but I am still fairly new to macs. I have been able to join my macbook to the AD domain without too many problems at all (Tiger 10.4.10).

    What I am having a problem with is mapping a shared folder to the mac. I do not want to use the "proper" home folder setup using the old style AD user account home folder entry as I do not want all the extra files and folders to appear in the mapped folder plus these iMacs will be used for mostly animation / video editing (HD and SD content) and audio work etc... I want them to work locally, they will have 500gigs to work with after all, and then to save to the network share for security etc... I assumed I would be able to do this with a simple script that would mount the shared folder but I have been unable to get it to work.

    I can map it from within Finder using "Go" "Connect to Server" and entering smb://<servername>/machomeshare/mac01 However this only maps to the top level share (machomeshare) and not to (mac01). But at least it works and places an icon within Finder and on the desktop. I know I could drag that share into startup items but I don't like that as it is not very flexible. I have also been able to mount the share to a folder within the users folder using mount_smbfs but as soon as I click on the folder in Finder it vanishes. It is still mapped but to get to it I have to use the command line to navigate to it, which I can't let the users do obviously.

    Ideally what I want is a script that will run at logon (I already have LoginWindow Manager) and will mount a shared folder depending upon the username (so map /machomeshare/mac01 if the username is mac01 etc...) . This mounted share should then be visible either on the desktop or within Finder (ideally both).


    Any help will be greatly appreciated.

    Richard

  2. #2

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740

    Re: Another how to map a windows share thread !

    You have bought 16 new Macs ?

    That's 16 Kittens god has now slaughtered becauuse of your actions. I hope your happy. ;-)


  3. #3
    DMcCoy's Avatar
    Join Date
    Oct 2005
    Location
    Isle of Wight
    Posts
    3,424
    Thank Post
    10
    Thanked 488 Times in 428 Posts
    Rep Power
    111

    Re: Another how to map a windows share thread !

    You can do stuff with the loginhooks, I've not mounted a share with it though. You can extract the AD username and home folder path. I've attached my login script, its no use for the mapping but it will give you some idea about getting sections of the username. I believe the username is passed as the first variable $1 to the loginhook.

    Code:
    #!/bin/sh
    #
    
    
    lookup_local=$(niutil -read . /users/$1 2> /dev/null)
    
    if [ "$lookup_local" != "" ]; then
    # this will grab local and mobile users, as they're both strictly 'local' users.
    
    auth_prop=$(niutil -readprop . /users/$1 authentication_authority 2> /dev/null | grep LocalCachedUser)
    if [ "$auth_prop" != "" ]; then
    
    # Do your stuff for mobile users here.
    logger "LoginHook: Starting for Mobile Account - $1"
    else
    
    # Do your stuff for local users here.
    logger "LoginHook: Starting for Local Account - $1"
    fi
    else
    
    # Do your stuff for network users here.
    logger "LoginHook: Starting for Network Account - $1"
    home_loc=$(dscl /Search -read /Users/$1 homeDirectory | sed 's| homeDirectory: ||g')
    /bin/mkdir -p /Medina/Caches/$1
    /usr/sbin/chown $1@medina.school:admin /Medina/Caches/$1
    /usr/bin/sudo -u $1 /bin/chmod 700 /Medina/Caches/$1
    
    homeshort=`echo $home_loc | awk '{print substr($0,25,2)}'`
    case $homeshort in
            02)
                    userpath="/Network/Servers/hyllus.medina.school/02/";;
            03)
                    userpath="/Network/Servers/hyllus.medina.school/03/";;
            04)
                    userpath="/Network/Servers/hyllus.medina.school/04/";;
            05)
                    userpath="/Network/Servers/hyllus.medina.school/05/";;
            06)
                    userpath="/Network/Servers/hyllus.medina.school/06/";;
            07)
    	userpath="/Network/Servers/hyllus.medina.school/07/";;
            08)
    	userpath="/Network/Servers/hyllus.medina.school/08/";;
            St)
                    userpath="/Network/Servers/hyllus.medina.school/Staff/";;
            sy)
                    userpath="/Network/Servers/hyllus.medina.school/sysadmin/";;
    
    esac
    echo $userpath$1/Library/Caches > /temp.txt                                       
    
    /usr/bin/sudo -u $1 /bin/rm -Rf $userpath$1/Library/Caches
    /usr/bin/sudo -u $1 /bin/ln -s /Medina/Caches/$1 $userpath$1/Library/Caches
    /usr/bin/sudo -u $1 /bin/rm -Rf $userpath$1/Library/Fonts/*
    /usr/bin/sudo -u $1 /bin/rm -Rf $userpath$1/Library/Printers/*
    /usr/bin/sudo -u $1 /bin/rm -Rf $userpath$1/.Trash/*
    if test -e $userpath$1/Library/Preferences/com.apple.print.PrintingPrefs.plist
            then
                    echo -n "Printer Preferences Exist"
            else
                    /usr/bin/sudo -u $1 /bin/cp /Medina/Configs/* $userpath$1/Library/Preferences/
    fi
    
    
    fi
    
    
    logger "LoginHook: Finished for - $1"

    Essentially i'm creating a local cache folder and setting the AD user permissions on it. The difficult part is the home folder is stored as a user setting, how os x applies this when the user logs in I've no idea.

  4. #4
    richardp's Avatar
    Join Date
    May 2007
    Location
    North Yorkshire
    Posts
    131
    Thank Post
    3
    Thanked 25 Times in 25 Posts
    Rep Power
    19

    Re: Another how to map a windows share thread !

    not being a cat lover that really doesn't bother me, also I fail to see what dog has to do with macs, unless I need to join some sort of sect to get this to work? Do the Scientologists have a Thetan based mac helpdesk ?



    Thanks for that DMcCoy I will have a look over the script and see if it gives me any ideas.

  5. #5
    thegrassisgreener's Avatar
    Join Date
    Jul 2007
    Posts
    177
    Thank Post
    3
    Thanked 2 Times in 1 Post
    Rep Power
    0

    Re: Another how to map a windows share thread !

    You can attatch a mac to your windows domain so it uses the logons from there Active Directory account. This can also map there Home Drive (H:\) to the Dock... See the following:

    Home Directories on a Mac

  6. #6
    DMcCoy's Avatar
    Join Date
    Oct 2005
    Location
    Isle of Wight
    Posts
    3,424
    Thank Post
    10
    Thanked 488 Times in 428 Posts
    Rep Power
    111

    Re: Another how to map a windows share thread !

    Oh, I should point out that without copying the user template with all those nasty folders you don't like, a number of programs won't run properly as they rather expect them to be there!

  7. #7

    GrumbleDook's Avatar
    Join Date
    Jul 2005
    Location
    Gosport, Hampshire
    Posts
    9,930
    Thank Post
    1,337
    Thanked 1,780 Times in 1,105 Posts
    Blog Entries
    19
    Rep Power
    594

    Re: Another how to map a windows share thread !

    Ok, ok ... I hold my hands up now to saying I am swearing at Macs due to something that is not quite right.

    I have a horrible feeling it is an admin error rather than a system flaw.

    The last lot of machines we had in (20" iMacs, latest version) are not loading home areas into the dock properly. The share is not being mounted into their home and I cannot see what is different to these compared to other machines.

    I know that there are people out there with similar issue but they have it across all machines (from 10.4.5 onwards) where as here ... it is just on the latest ones built.

    I am going to build a new image in the next day or so ... use Roberto's model of setting up the user template and go from there.

    Failing that we are back to login hooks (thanks for the refresher on them ... muchly needed!)

  8. #8
    DMcCoy's Avatar
    Join Date
    Oct 2005
    Location
    Isle of Wight
    Posts
    3,424
    Thank Post
    10
    Thanked 488 Times in 428 Posts
    Rep Power
    111

    Re: Another how to map a windows share thread !

    check the system.log for any complaints. I do notice that it tries to mount every home folder ever accessed when it logs in, very helpful seeing as it can only see the one belonging to the user.

    Is there any other weirdness like it works if you login, logout and login again? Do the prefs get applied correctly? I usually change the little message on the login screen on the server and reboot the client. If it doesn't update on boot then you can try adding a delay to the boot sequence, I've got a link to it somewhere.

    Oh, afp or smb? I find smb rather limiting as you can see I'm using symlinks.

  9. #9
    richardp's Avatar
    Join Date
    May 2007
    Location
    North Yorkshire
    Posts
    131
    Thank Post
    3
    Thanked 25 Times in 25 Posts
    Rep Power
    19

    Re: Another how to map a windows share thread !

    Hi thanks for the replies,

    However I do not think I am describing what I want to achieve very well.

    When the user logs on with their AD user account that account is stored locally with all the "nasty folders" like a windows profile. They then work locally and if whatever they are doing (such as photoshop or final cut) produces some work they are then able to save just the work/project onto the server for safety.

    I realise that I can use the old NT user account home folder map option in their AD user account, I will if I have to, but I don't like using that and would much rather use a script which can be more flexible in the future. For example what would I do if I needed to add another mapped drive letter in the future for some other purpose, such as a resources folder etc...


    richard

  10. #10
    DMcCoy's Avatar
    Join Date
    Oct 2005
    Location
    Isle of Wight
    Posts
    3,424
    Thank Post
    10
    Thanked 488 Times in 428 Posts
    Rep Power
    111

    Re: Another how to map a windows share thread !

    The issue is the path to the home directory is held in either AD or the netinfo database, which there won't be any users for if you are logging into AD. This causes issues if you want it to show up as their "home folder" rather than just having it as a mount point. I'm not sure if macs will mount a subfolder with smb or afp (I know afp will only mount to one level down).

    This caused me to do the following.

    Each user has two home folders. One on a mac server, one on a windows server.

    Window: AD holds the path to the mac home folder. This is mounted when the user logs in to Windows a N: A script attached the each gpo maps an H: drive to the users windows folder, The my documents is also redirected to this path.

    On the Mac side the AD home folder (pointing to the mac server) is mounted with afp. I've not got around to mounting the users Windows folder yet.

  11. #11

    GrumbleDook's Avatar
    Join Date
    Jul 2005
    Location
    Gosport, Hampshire
    Posts
    9,930
    Thank Post
    1,337
    Thanked 1,780 Times in 1,105 Posts
    Blog Entries
    19
    Rep Power
    594

    Re: Another how to map a windows share thread !

    In my previous place we used to use AFP to mount the volume and then use login hooks to redirect ~/ to their home area ... but there were repaeted issues of drops in traffic for AFP on the windows servers. We could have gone for ExtremeZ-IP to fix it but there wasn't the money available.

    If have steered clear of AFP for home areas since and have been fine up until the present bunch of machines ...

    The log files say the mount is there ... there just isn't anything in it and ~/ is not redirected to the home area either.

    I'll feedback on thursday once the new image is built.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 15
    Last Post: 23rd March 2007, 08:47 AM
  2. BSF/PFI thread on ICTTechnician.com
    By GrumbleDook in forum General Chat
    Replies: 12
    Last Post: 26th April 2006, 01:45 PM
  3. Screencasts Request Thread
    By russdev in forum General EduGeek News/Announcements
    Replies: 4
    Last Post: 23rd April 2006, 10:59 PM
  4. VNC, Remote Desktop, etc thread
    By Inox in forum Windows
    Replies: 11
    Last Post: 2nd August 2005, 09:53 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
  •