Folder Redirections (MCX Redirector)

Apple Xserve

I recently wrote an article on how to create a script to empty the Trash when an Active Directory user logged out of a client computer. This required us to mess around with the trust relationship a little between the client computer and the server. Now with the use of the ‘ManagedClient.app’ and ‘Folder Redirections’ we don’t have to worry about that anymore!


So go ahead an open up Workgroup Manager. Navigate to your OD, Authenticate and head over to the Preferences window. By default you will be in ‘Overview’ mode so switch to ‘Details’ and select the + at the bottom.

Navigate to the following location and import this in the browse window that opened.

\System\Library|Core Services\ManagedClient.app

You will now have a load of new preference manifests in the Details view now. We’ll take a look at more of these another time, but for now scroll down and open ‘Folder Redirection’.

By default this will be blank, but fear not – I’ll tell you what you need to enter here. Expand ‘Always’ and hit ‘New Key’. A blank ‘New Item’ will appear with an orange icon next to it indicating that there is no managed preference yet. Click the drop down list that appeared next to the ‘New Item’ and select ‘Logout Redirections’.

Other options here include ‘Login redirections’ and ‘Other Redirections’ but we’ll take a look at these another time. Expand ‘Logout Redirections’ and click ‘New Key’ – ‘Redirect Action’ will then appear. Expand this too.

You can see some keys have been created and auto-filled. Next to the ‘Action’ key where it says ‘deleteAndCreateSymLink’ is a drop down list of other actions. They are all explained at the bottom when you select them, so I won’t go on to explain all the functions here. Take a look through all of them and then select ‘deletePath’.

Set the ‘Destination Folder Path’ and ‘Folder Path’ as follows:

/tmp/%@/.Trash
~/.Trash

This basically means that when the user logs out, the hidden .Trash folder will be deleted. Test to make sure it works by logging in to a client and then filling up the Trash. Logout and back to see if has gone through ;)

Print Friendly
  • Ben

    Hi Simon,

    I tried this and it works great for the first couple of attempts then it seems to strip away all permissions on the .trash directory requiring an admin username/password when moving anything to the trash.

    I’d really like to implement this and just wondered if you had any advice?

    Cheers,

    Ben

    • Simon

      Hi Ben, I haven’t experienced the issue you are having. Which version of Mac OS X are you running? Do your AD users have their Home Directories auto mount when they login, with no access to a Local Home Directory?

  • Ben

    Cheers for getting back to me Simon,

    We’re running 10.6.8 with the network home mapped via UNC path found in AD with no local home directory.

    Thanks,

    Ben

    • Simon

      Hi Ben,

      Sorry for the delay in getting back to you. I was away on holiday.

      I honestly can’t say what your issue is. I have the same setup and have never experienced your error.

      Have you tried checking any Console logs to see if there are any clues in there?

  • http://www.facebook.com/jamie.rudd1 Jamie Isadaddy Rudd

    Hi Simon

    Thanks for publishing your article. I have a question. How would I change the users home directory to the directory of their home share on the network? Is there some sort of SMB user variable I can use?

    I am struggling finding this information.

    Your help would be greatly appreciated.
    Thanks
    Jamie

    • http://www.mactasia.co.uk/ Simon

      Hi Jamie,

      When you bind to Active Directory, you need to uncheck “Force local home directory on Startup disk” and check “Use UNC path from Active Directory…” select SMB as your protocol.

      • http://www.facebook.com/jamie.rudd1 Jamie Isadaddy Rudd

        Brilliant. That makes things a little easier. Can I just not re map Documents/Movies/Pictures to the SMB using the MCX Redirector?

        Thanks again.

        • http://www.mactasia.co.uk/ Simon

          If you login as an AD user it should create many of the default directories for you manually. Use redirector for things you don’t want taking up space on your AD server (like Library etc) and point them at the local HD.

          • http://www.facebook.com/jamie.rudd1 Jamie Isadaddy Rudd

            Nice one. Cheers

          • http://adambrown.me Adam Brown

            Did you manage to get this to work? I am trying to set up exactly the same thing,

          • http://www.mactasia.co.uk/ Simon

            It sure works with Snow Leopard clients. I haven’t tried with Lion or Mountain Lion.

  • Pingback: Library Folder on Apple Macs