speeding_ant Posted October 27, 2014 Author Share Posted October 27, 2014 Is there a way to mount the afp shares with read and write permission for all administrative users? As of now only the user that runs the script gets to read the volumes. Current this is a 'per user' script. Network filesystems work in strange ways in Mac OS X, with AFP/SMB sessions 'attaching' themselves to a particular UID once accessed. You could experiment using autofs... can't guarantee that will solve your problem though. Why not just manually implement this script on all administrative users? Quote Link to comment
erikssone Posted October 27, 2014 Share Posted October 27, 2014 ... Why not just manually implement this script on all administrative users? I think that'll cause problems with fast user switching. I'm currently using a automount solution but that has the same problem; the first user to access the volume sets the mode to 700. Frustrating... I'll keep an eye out here it someone finds a good solution. /Erik Quote Link to comment
speeding_ant Posted October 27, 2014 Author Share Posted October 27, 2014 What about mounting the volumes to somewhere other than /Volumes? Modification of the script to use the username as a variable to mount at /Volumes/username/Share, or change the mount command to mount onto the desktop directly (~/), and use flag nobrowse to prevent it from showing up in Finder. Quote Link to comment
erikssone Posted October 28, 2014 Share Posted October 28, 2014 What about mounting the volumes to somewhere other than /Volumes? Modification of the script to use the username as a variable to mount at /Volumes/username/Share, or change the mount command to mount onto the desktop directly (~/), and use flag nobrowse to prevent it from showing up in Finder. I tried the automount way and mounting the shares in /Users/Shared/servers and got the exact same issue, the first user to access the share made it it's share, example erik:staff and mode 700 which ment it became inaccessible for other users within the staff group. Is it possible to mount the same shares in different locations? (Not necessarily with your script) Ex) mount_afp afp://user:[email protected]/Public /Users/user1/shares mount_afp afp://user:[email protected]/Public /Users/user2/shares Quote Link to comment
speeding_ant Posted October 29, 2014 Author Share Posted October 29, 2014 What about mounting the volumes to somewhere other than /Volumes? Modification of the script to use the username as a variable to mount at /Volumes/username/Share, or change the mount command to mount onto the desktop directly (~/), and use flag nobrowse to prevent it from showing up in Finder. I tried the automount way and mounting the shares in /Users/Shared/servers and got the exact same issue, the first user to access the share made it it's share, example erik:staff and mode 700 which ment it became inaccessible for other users within the staff group. Is it possible to mount the same shares in different locations? (Not necessarily with your script) Ex) mount_afp afp://user:[email protected]/Public /Users/user1/shares mount_afp afp://user:[email protected]/Public /Users/user2/shares Not sure... give it a go! Use different usernames and passwords, as mount commands use an existing session if available. Quote Link to comment
erikssone Posted November 12, 2014 Share Posted November 12, 2014 Problems I created a folder called shares in /Users/myuser Edited the script to mount in '/Users/myuser/shares/' It seems as if I have to manually delete the content of /Users/myuser/shares/ for the script to mount the shares again - the folders from prior mounting causes problems. /Users/myuser/shares has mode 700 and owner myuser:staff and the same goes for the folders the script creates when mounting the shares. "Mount already exists" but it's just empty folders. How come? Quote Link to comment
Squiddles Posted December 31, 2014 Share Posted December 31, 2014 Hi, I am struggling getting this script working. When I run '/Scripts/mount.sh' I get the result below. What does this mean, and what have I done wrong to cause this error? Thanks Simons-MacBook-Pro:~ simonosborne$ /Scripts/mount.sh /Scripts/mount.sh: line 84: edit: command not found usage: ping [-AaDdfnoQqRrv] [-b boundif] [-c count] [-G sweepmaxsize] [-g sweepminsize] [-h sweepincrsize] [-i wait] [?k trafficclass] [-l preload] [-M mask | time] [-m ttl] [-p pattern] [-S src_addr] [-s packetsize] [-t timeout][-W waittime] [-z tos] host ping [-AaDdfLnoQqRrv] [-b boundif] [-c count] [-I iface] [-i wait] [?k trafficclass] [-l preload] [-M mask | time] [-m ttl] [-p pattern] [-S src_addr] [-s packetsize] [-T ttl] [-t timeout] [-W waittime] [-z tos] mcast-group /Scripts/mount.sh: line 191: [: ==: unary operator expected /Scripts/mount.sh: line 205: [: ==: unary operator expected /Scripts/mount.sh: line 216: [: ==: unary operator expected Simons-MacBook-Pro:~ simonosborne$ Quote Link to comment
burnedpixel Posted February 8, 2015 Share Posted February 8, 2015 Hi, I am struggling getting this script working. When I run '/Scripts/mount.sh' I get the result below. What does this mean, and what have I done wrong to cause this error? Thanks Simons-MacBook-Pro:~ simonosborne$ /Scripts/mount.sh /Scripts/mount.sh: line 84: edit: command not found usage: ping [-AaDdfnoQqRrv] [-b boundif] [-c count] [-G sweepmaxsize] [-g sweepminsize] [-h sweepincrsize] [-i wait] [?k trafficclass] [-l preload] [-M mask | time] [-m ttl] [-p pattern] [-S src_addr] [-s packetsize] [-t timeout][-W waittime] [-z tos] host ping [-AaDdfLnoQqRrv] [-b boundif] [-c count] [-I iface] [-i wait] [?k trafficclass] [-l preload] [-M mask | time] [-m ttl] [-p pattern] [-S src_addr] [-s packetsize] [-T ttl] [-t timeout] [-W waittime] [-z tos] mcast-group /Scripts/mount.sh: line 191: [: ==: unary operator expected /Scripts/mount.sh: line 205: [: ==: unary operator expected /Scripts/mount.sh: line 216: [: ==: unary operator expected Simons-MacBook-Pro:~ simonosborne$ I came across this issue last night and happened upon this thread so I figured I'd throw you a bone. I think it comes down to TextEdit just being an awful option for editing code. The machine I was editing the script on didn't have anything else, so I used TextEdit. I got the same error as you. Then I installed SublimeText, opened the script, and noticed the syntax highlighting was all screwed up after a certain line. TL;DR: TextEdit inserted smart quotes. Go through all the areas where you might have modified an option (e.g. "Do you want iTunes open?") and make sure there are plain double quotes (") instead of fancy double quotes (”). Script runs perfectly after you fix that. Quote Link to comment
kamhighway Posted April 26, 2015 Share Posted April 26, 2015 Where can I get the latest version of this script with the change described in the first post on 28/12/2012? **NEW** Added functionality to wake the server via WOL **NEW** 28/12/2012 - Added the ability to call "wake" at the end of the script to wake the server, no matter which time it is. eg: /scripts/mount.sh wake When I click on the link in the first post to download the script, the resulting file is dated Dec. 27, 2011 and does not seem to include this added functionality. Thanks in advance. Quote Link to comment
roma Posted July 11, 2015 Share Posted July 11, 2015 It seems the auto-open iTunes rule doesn't work anymore with the latest release of iTunes (12.2.x). Anyone else noticed this? Quote Link to comment
ChrisGVE Posted September 20, 2015 Share Posted September 20, 2015 Using it with iTunes 12.3 without issue (on Yosemite and El Capitan). I noticed a small bug with the script. In case you'd not want to open iTunes automatically but you'd want to close it in case the network is not available the section of code # Opens iTunes if TRUE and Server if [ $ITUNES == "TRUE" ] && [ $AVAILABLE == "TRUE" ]; then if (! ps ax | grep -v grep | grep -v iTunesHelper | grep /Applications/iTunes.app/Contents/MacOS/iTunes > /dev/null ); then echo "Attempting to open iTunes" open /Applications/iTunes.app/ fi else if [ $ITUNESQUIT == "TRUE" ]; then echo "Attempting to close iTunes" osascript -e 'tell application "iTunes" to quit' fi fi will not work properly, in fact you need to add a condition to the second nested if # Opens iTunes if TRUE and Server if [ $ITUNES == "TRUE" ] && [ $AVAILABLE == "TRUE" ]; then if (! ps ax | grep -v grep | grep -v iTunesHelper | grep /Applications/iTunes.app/Contents/MacOS/iTunes > /dev/null ); then echo "Attempting to open iTunes" open /Applications/iTunes.app/ fi else if [ $ITUNESQUIT == "TRUE" ] && [ $AVAILABLE == "FALSE" ]; then echo "Attempting to close iTunes" osascript -e 'tell application "iTunes" to quit' fi fi Quote Link to comment
backayard Posted September 20, 2015 Share Posted September 20, 2015 Working perfectly on Yosemite and El Capitan, just what I was looking for for my Plex I couldn’t get it to work at first until I edited the script with SublimeText, thanks to burnedpixel, TextEdit was screwing up the script. Also I couldn't get com.media.mount.plist to work until I select Get Info and change the Sharing & Permissions to read only for staff and everyone, keep user to read&write Here is my setup # Script Location SCRIPTLOCATION="/Scripts" # Username for server USERNAME="NASusername" # Password for server, check notes PASSWORD="password" # IP Address/hostname for ping PING="192.168.1.1" # Hostname for server. Try sername.local, hostname or IP HOSTNAME="Nas.local" # Protocol in lowercase, afp or smb PROTOCOL="afp" # Shares, check notes SHARES="Music Plexdrive" Quote Link to comment
mikeybunting Posted October 16, 2015 Share Posted October 16, 2015 Sorry if this has been answered before (or perhaps common knowledge here)...but does using/utilizing this script keep shared network drives from hibernating? I have a Synology NAS and need to be able to have the disks hibernate when not in use but if this script wakes them each time it runs then I may have to look elsewhere. Thanks. Quote Link to comment
thegreatgumbino Posted December 9, 2015 Share Posted December 9, 2015 I gave up and re-imported all my iTunes files and the old mount files off the old drive. Put everything in place and iTunes opened right up and I've been playing music uninterrupted since. Love this! Thanks again for everyone's efforts on this. Hoping someone can provide some guidance. I was running this successfully for the last few years, including after an upgrade to El Capitan. Recent problems with my macbook resulted in a trip to the Genius bar and a recommendation to perform a clean install. I installed a new SSD, performed a clean install of 10.11, and have been trying to manually restore all my settings/files versus a TM backup to ensure everything is clean. I've been successful so far, except for getting this working. I saved an old copy of my mount.sh file and used it to populate a new fresh copy downloaded from the original post (used TextWrangler). I've read through this entire thread, and still can't get it to work. Included is a copy of my mount.sh file. 1) Create a folder called "Scripts" on the root of your hard drive, and copied mount.sh to /Macintosh HD/Scripts 2) Created LaunchAgents folder and copied com.media.mount.plist to *Username*/Library/LaunchAgents folder. 3) Terminal entry: - sudo chown root:staff /Scripts/mount.sh - sudo chmod 775 /Scripts/mount.sh 4) Restart 5) From a fresh restart, if I run /Scripts/mount.sh from Terminal, I get the following: 6) I have finder preferences set to show shared connected servers and see Tower. Clicking on it all, all my shares are available. Clicking on "Music" mounts the drive, and it shows up on the desktop since finder preferences is set to show connected servers on the desktop. If I rerun /Scripts/mount.sh, I get: I'm confused since the share will mount through the finder, but not the script. Additionally, when I open iTunes my library is viewable, however I can only play 45 seconds of a track before iTunes shuts down. Any help would be greatly appreciated. Quote Link to comment
wgstarks Posted March 19, 2016 Share Posted March 19, 2016 I've been trying to get this to work without any luck. OS= 10.11.3 When I restart my computer nothing mounts. If i try to run mount.sh manually I get this- maggie:~ wgstarks$ /Scripts/mount.sh PING 10.0.1.20 (10.0.1.20): 56 data bytes --- 10.0.1.20 ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.205/0.358/0.432/0.090 ms Mounting flash ... mount_smbfs: URL parsing failed, please correct the URL and try again: Invalid argument flash mount failed. Check settings/server. Removing mount point. ************* Mounting Media ... mount_smbfs: URL parsing failed, please correct the URL and try again: Invalid argument Media mount failed. Check settings/server. Removing mount point. ************* Attempting to close iTunes I've attached a copy of mount.sh mount_copy.sh.zip Quote Link to comment
Kimovitzh Posted March 21, 2016 Share Posted March 21, 2016 This is some thing iv'e been looking for, Fantastic! But, when i add more than one share i get this: PING 10.0.1.137 (10.0.1.137): 56 data bytes --- 10.0.1.137 ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 1.485/1.601/1.664/0.061 ms Mounting Gringotts appdata ... mount_smbfs: mount error: /Volumes/Gringotts appdata: Unknown error: -1073741275 Gringotts appdata mount failed. Check settings/server. Removing mount point. ************* I did the %20 part in the share section # Shares, check notes SHARES="Gringotts%20appdata" Quote Link to comment
wgstarks Posted March 21, 2016 Share Posted March 21, 2016 This is some thing iv'e been looking for, Fantastic! But, when i add more than one share i get this: PING 10.0.1.137 (10.0.1.137): 56 data bytes --- 10.0.1.137 ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 1.485/1.601/1.664/0.061 ms Mounting Gringotts appdata ... mount_smbfs: mount error: /Volumes/Gringotts appdata: Unknown error: -1073741275 Gringotts appdata mount failed. Check settings/server. Removing mount point. ************* I did the %20 part in the share section # Shares, check notes SHARES="Gringotts%20appdata" Since you say "More than one share" I'm making a guess that maybe this is two shares? If so, the code should read Gringotts appdata. The %20 is only used to replace spaces in the name of the share. Is the actual name of the share Gringotts appdata? Quote Link to comment
Kimovitzh Posted March 21, 2016 Share Posted March 21, 2016 This is some thing iv'e been looking for, Fantastic! But, when i add more than one share i get this: PING 10.0.1.137 (10.0.1.137): 56 data bytes --- 10.0.1.137 ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 1.485/1.601/1.664/0.061 ms Mounting Gringotts appdata ... mount_smbfs: mount error: /Volumes/Gringotts appdata: Unknown error: -1073741275 Gringotts appdata mount failed. Check settings/server. Removing mount point. ************* I did the %20 part in the share section # Shares, check notes SHARES="Gringotts%20appdata" Since you say "More than one share" I'm making a guess that maybe this is two shares? If so, the code should read Gringotts appdata. The %20 is only used to replace spaces in the name of the share. Is the actual name of the share Gringotts appdata? I misunderstood the guide, thought it was the other way around, so tried with a space instead og %20 and it didn't work, so i realized that the share "appdata" was AFP only, tried with another share ant with th space and it worked. So n00b mistake of misreading the guide. Thanks for the quick support Quote Link to comment
wgstarks Posted March 21, 2016 Share Posted March 21, 2016 Mind if I ask what OS your using on your Mac? I can't get mine working with El Capitan and SMB shares. Quote Link to comment
Kimovitzh Posted March 21, 2016 Share Posted March 21, 2016 Mind if I ask what OS your using on your Mac? I can't get mine working with El Capitan and SMB shares. I'm on El Capitan (10.11.13) both SMB and AFP working. How did you edit the mount.sh? First i edited it in textEdit but it didn't work, so downloaded it again and edited it in terminal with nano. Quote Link to comment
wgstarks Posted March 21, 2016 Share Posted March 21, 2016 I edited with TextWrangler (BBEdit lite). Much better than TextEdit. I don't think that's the problem but I could try nano. Can you describe the process to edit? Quote Link to comment
Kimovitzh Posted March 21, 2016 Share Posted March 21, 2016 I edited with TextWrangler (BBEdit lite). Much better than TextEdit. I don't think that's the problem but I could try nano. Can you describe the process to edit? Re-download and replace the mount.sh go to terminal, and: $ nano /Scripts/mount.sh Edit so the settings mach what you got, and when you are done pres ctrl + x, the y for yes and enter to confirm and exit. Quote Link to comment
wgstarks Posted March 21, 2016 Share Posted March 21, 2016 Success. Wasn't anything wrong with the text editing. Totally user error. When I opened the file in terminal it displayed the instructions over and over. # PASSWORD: If your password contains symbols, they must be url encoded # # ie: "@" becomes "%40". To encode your password, use this site: # # http://www.opinionatedgeek.com/dotnet/tools/urlencode/Encode.aspx # I really should read the instructions first. BTW- If you want a good substitute for TextEdit you should checkout TextWrangler. Free and very versatile. Thanks for the help. Quote Link to comment
Kimovitzh Posted March 22, 2016 Share Posted March 22, 2016 Success. Wasn't anything wrong with the text editing. Totally user error. When I opened the file in terminal it displayed the instructions over and over. # PASSWORD: If your password contains symbols, they must be url encoded # # ie: "@" becomes "%40". To encode your password, use this site: # # http://www.opinionatedgeek.com/dotnet/tools/urlencode/Encode.aspx # I really should read the instructions first. BTW- If you want a good substitute for TextEdit you should checkout TextWrangler. Free and very versatile. Thanks for the help. Well it helps to read the instructions, and read them right Thanks for the tip! Quote Link to comment
Russ Uno Posted March 22, 2016 Share Posted March 22, 2016 Never had an issue editing code in TextEdit, been doing it for years. Just make sure your file is set to plain text and Smart Quotes is disabled in preferences before you open/start a new file. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.