Jump to content

Mount specific folder on desktop


Recommended Posts

Guest theeldergeek
Posted (edited)

I am looking for a way to mount a specific folder (or alias to said folder) on users desktop.

 

The folder will be one of those in the users home drive, i.e. music, so is available via Finder, but it needs to appear on the desktop at login.

 

I've 'mapped' network drives to groups, so when anyone in that group logs in, they see a couple of mounted shares, but the way I want to do it, is to create a group, and for that group, the same folder in each users home drive gets mounted rather than have to configure each users account to mount the folder.

 

So, when User1 logs in, his music drive is mounted on the desktop, the same for User2 and so on, but done at a group level, not account level.

 

Make sense? How?

Edited by theeldergeek
Posted

What method are you using currently to map the shared drives? Not to throw any more complications into the arena but could you assign an Automator sequence to your group in order to map their "~/Music" drive at logon?

 

Michael

Guest theeldergeek
Posted
What method are you using currently to map the shared drives? Not to throw any more complications into the arena but could you assign an Automator sequence to your group in order to map their "~/Music" drive at logon?

 

Michael

 

I'm using WGM which for each group under PREFS > LOGIN > ITEMS is "ALWAYS" managed and has the respective shares shown in the list.

 

Automator is something I've yet to master :o

Would this be fairly straightforward?

 

I presume there is no way to do this using WGM then; it does seem to only allow specific shares to be added rather than per user.

 

I'm glad you seem to have grasped what I want to do as I really didn't think I had explained it that well! :D

Posted

If I understand it right you want to automate the process of mounting a folder or a shortcut to the desktop for each user in a group - if not then i haven't grasped it! haha

 

I am not familiar with workgroup manager as I don't have OSX Server but if I understand correctly, it allows you to manage what would be 'group policy' objects on a microsoft server environment -

 

Apple Automator similarly to VBScript allows you to automate tasks such as logon/logoff scripts and it can be done with a kind of WYSIWYG editing format - so for instance to map a folder you would set click drop-down box 1 to open Finder tools, then drop-down box 2 to select 'connect to server' etc. - But of course there is the ability to script processes to maintain efficiency

 

I'm going to stab a guess that WGM allows integration of Automator files/scripts but I might be wrong and my 2 and 2 together are making 3... haha

 

Anyway if it does indeed let you execute Automator files then somewhere in the process you would set the folder mounting path to "~/Desktop" and the user's folder to "~/Music" so that your username becomes the variable (~ tilde is used for 'home' variable) and thus the automator file can be run by any of the users in the group to achieve the same outcome

 

Thanks

Guest theeldergeek
Posted (edited)
If I understand it right you want to automate the process of mounting a folder or a shortcut to the desktop for each user in a group - if not then i haven't grasped it! haha

 

I am not familiar with workgroup manager as I don't have OSX Server but if I understand correctly, it allows you to manage what would be 'group policy' objects on a microsoft server environment -

 

Apple Automator similarly to VBScript allows you to automate tasks such as logon/logoff scripts and it can be done with a kind of WYSIWYG editing format - so for instance to map a folder you would set click drop-down box 1 to open Finder tools, then drop-down box 2 to select 'connect to server' etc. - But of course there is the ability to script processes to maintain efficiency

 

I'm going to stab a guess that WGM allows integration of Automator files/scripts but I might be wrong and my 2 and 2 together are making 3... haha

 

Anyway if it does indeed let you execute Automator files then somewhere in the process you would set the folder mounting path to "~/Desktop" and the user's folder to "~/Music" so that your username becomes the variable (~ tilde is used for 'home' variable) and thus the automator file can be run by any of the users in the group to achieve the same outcome

 

Thanks

 

The folder I want to mount is each individual's own folder, in this instance their individual music folder. It's for a music exam, so rather than them have to go via Finder, it would be good to have it located on the desktop, ready for access. It would be good to be able to change the folder that appears 'on the fly', so automator may be the way to go here.

 

I have no idea if WGM allows integration of Automator tasks though - this is something I will need to explore.

 

Useful info about ~tilde by the way, that may smooth things through if I am able to enter that as a home variable.

 

Thanks so far. If I have success, I will of course post back.

Edited by theeldergeek
Posted

ive got this script running for every suer on login (i just saved it under applications) (though it does seem to add every time you run it filling up desktop with folders

 

set MyName to do shell script "whoami"
tell application "Finder"
try
mount volume "smb://server.domain.local/" & MyName & "$"
do shell script "ln -s /Volumes/" & MyName & "$ ~/Desktop"
end try
try
mount volume "smb://server.domain.local/" & "resources$"
do shell script "ln -s /Volumes/" & "resources$" & " ~/Desktop"
end try
try
mount volume "smb://server.domain.local/" & "multimedia$"
do shell script "ln -s /Volumes/" & "resources$" & " ~/Desktop"
end try
end tell

Posted
If the shortcut doesn't have to be on the desktop, couldn't you just add the ~\Music folder to the dock preferences for the group of users doing the exam in WGM?
Guest theeldergeek
Posted (edited)
If the shortcut doesn't have to be on the desktop, couldn't you just add the ~\Music folder to the dock preferences for the group of users doing the exam in WGM?

 

Forgot about the Dock! How would I specify the folder? I can only + or - in WGM, no option to specify with a ~ or anything. I can obviously add the "Documents" folder to the Dock, but I am trying to get a specific folder to appear to ensure candidates on the exam aren't rooting around trying to find what they need. I can't use a normal share, as they need RW access to the files, which could be very problematic if several users are accessing them at the same time.

Edited by theeldergeek
Posted

See if this works.

 

Log in as a user in the group. Drag the Music folder onto your dock and then in the plist edit the the line for the music folder to read ~/Music. Once this is done then add the plist to the list of managed preferences.

 

Alternatively, maybe you could create a launchd using lingon and use the script provided above by sted. Copy the script into a location and hide it and then configure lingon to call the script as part of the launchd process on login?

Guest theeldergeek
Posted

@Hodgehi

 

I'll give it a try and let you know how I get on - thanks.

Guest theeldergeek
Posted
If the shortcut doesn't have to be on the desktop, couldn't you just add the ~\Music folder to the dock preferences for the group of users doing the exam in WGM?

 

Going to be working on this tomorrow, will post how I get on.

Posted
Apologies for the delay getting back to you. HodgeHi's method was what I was going to suggest. We have different Dock plist's setup for Art, Music, Media, Exams & Evening Classes with each one containing different icons/shortcuts for each group. It works really well.
Guest theeldergeek
Posted
Give me a clue where I am going to find the plist :D
Posted

The file you need to look for is: ~/Library/Preferences/com.apple.dock.plist

 

If you ever want to make changes to the plist in the future you can also use Apple's Property List Editor (which is bundled with their Xcode developer tools package).

Posted (edited)
By the way, if you end up with duplicate copies of the Downloads and Documents folders in your Dock(s) you will need to remove these entries from your com.apple.dock.plist file using the Property List Editor. You should find each icon/shortcut is listed as a separate "Item" under the "persistent-others" section which controls the right-hand side of the Dock. Edited by Arthur
Posted
though it does seem to add every time you run it filling up desktop with folders

 

This AppleScript may help with that (although you will need to modify it a bit first).

 

-- Define variables

-- STRING LIST, all network shares to work with
set disk_list to {"share1", "share2", "share3"}
-- STRING, prefix to the network shares (for NFS only)
set disk_prefix to "/usr/local/symlinks/nfs"
-- STRING, server hostname (use IP if not using SMB)
set server to "192.168.0.17"
-- STRING, protocol, e.g. "smb://" or "ftp://"
set protocol to "smb://"

-- Mount Volumes

tell application "Finder"
 -- get every non-local disk
 set all_disks to every disk whose local volume is false
 -- set variable for mounting
 set already_mounted to false
 
 -- go through all found disks ...
 repeat with current_disk in all_disks
   try
     -- ... and check, if names match with defined shares
     if name of current_disk is in disk_list then
       eject current_disk
       -- as we found at least one mounted share, no need to remount (all)
       set already_mounted to true
     end if
   end try
 end repeat
 
 -- check if in the preceding action any drive was unmounted
 if already_mounted is false then
   -- go through disk list and mount every 'volume' from 'server' with 'protocol'
   repeat with volume in disk_list
     try
       -- build string for mount path to server share
       set mount_path to protocol & server & disk_prefix & "/" & volume
       mount volume mount_path
     end try
   end repeat
 end if
 
end tell

Guest theeldergeek
Posted
Did you get it working? :)

 

No, sorry, been tied up with other stuff at the moment. Not sure when I am going to be able to work on this now; unlikely to be this week.

Guest theeldergeek
Posted
This AppleScript may help.....

 

Yee Gads! You've gone way out of my comfort zone now. I need to know how to undo what I've done before I start running scripts.

 

:fear:

Posted

I'm using a Symbolic link created in my log on hook (ln -s Target NameOfLink)

That way it gets created for each user using the $1 variable (username) from the logon hook, and it gets created at every login and gets replaced at each login if the user deletes it.

Guest theeldergeek
Posted
I'm using a Symbolic link created in my log on hook (ln -s Target NameOfLink)

That way it gets created for each user using the $1 variable (username) from the logon hook, and it gets created at every login and gets replaced at each login if the user deletes it.

 

Waaaaay over my head at the moment; I clearly have some learning to do

Thanks anyway.

 

:getmecoat:

Guest theeldergeek
Posted
Did you get it working? :)

 

The moment has passed. I just set up a few accounts and got each user to log in and use a specific folder via Finder rather than force mount on the dock or desktop. I would still like to get this working although it will have to go on the back burner for a while. Might be a Summer Hols 'project' now.

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