saplinpoo Posted March 18, 2010 Posted March 18, 2010 I'm in the process of using launchd to launch a script at login which automounts students windows home shares to the desktop. I am using the script which is available from the deploystudio wiki (deploystudio - OS X 10.5 Login Hooks), but I am consistently getting errors. the jist of the code i'm using is... ## Set the $usrname variable usrname=$(/usr/bin/id -P | awk -F: '{ print $1 }') if [ $usrname != "admin" ] then if [ $usrname != "root" ] then mkdir /Users/$usrname/Desktop/"School Home" mount_smbfs //$usrname@[server]/$usrname$ /Users/$usrname/Desktop/"School Home" I have given up trying to get it working in the script as I am consistently getting the following error in the log... mount_smbfs: mount error: /Users/[usrname]/Desktop/School Home: No such file or directory I have started trying to simply get this working in the terminal replacing the variables with ones i know are correct, but get the same error consistently saying that the path doesn't exist!! But it blatently does!!! Can anybody see what i'm doing wrong, or have had the same problem and solved it? I've spent the past 48 hours pulling my hair out!! thanks, Arron
srochford Posted March 18, 2010 Posted March 18, 2010 I think it needs escaping: mount_smbfs //$usrname@[server]/$usrname$ /Users/$usrname/Desktop/School\ Home Alternatively, just leave out the space altogether - it will make life easier (I wish I could just disable the space bar for file and folder names :-))
saplinpoo Posted March 18, 2010 Author Posted March 18, 2010 I think i've just figured out what's wrong. The address to the share was incorrect, but the log file misled me into thinking something was wrong with the path. Damn log files!! Thanks for your help.
Carter Posted October 1, 2010 Posted October 1, 2010 I'm having some trouble understanding this script ... rather how to fill it out correctly if not doing it right below. This is what I see from above: ## Set the $usrname variable usrname=$(/usr/bin/id -P | awk -F: '{ print $1 }') if [ $usrname != "admin" ] then if [ $usrname != "root" ] then mkdir /Users/$usrname/Desktop/"H Drive" mount_smbfs //$usrname@Server_Name/$usrname$ /Users/$usrname/Desktop/"H Drive" fi fi killall Terminal Here is what I've get out of it for our site: Set the $usrname variable usrname=$(/usr/bin/id -P | awk -F: '{ print $1 }') if [ $usrname != "admin" ] then if [ $usrname != "root" ] then mkdir /Users/$usrname/Desktop/"H Drive" mount_smbfs //$usrname@SERVER/share$/$usrname$ /Users/$usrname/Desktop/"H Drive" fi fi killall Terminal where the following is the server & share path SERVER/share$/ For testing I'm running "su /script path I get prompted for a password, then get this error - "username" is not in the sudoers file.
AntonioRocco Posted October 1, 2010 Posted October 1, 2010 (edited) @salinpoo If I've understood you correctly why don't you use WorkGroup Manager to achieve this? You can specify a policy to auto-mount shares at a login time by installing WorkGroup Manager on a client workstation. Use Connect to Server from the Go Menu and try to use the IP Address of the Samba share as it tends to be more reliable. There are threads that have covered this already. @Carter If you need to issue a command or login to a shell using root you really should be using any one of these: sudo -s sudo su sudo su - My personal preference is "sudo -s" however it's your choice. You could refer to the relevant manual pages if you wish: Loading… Loading… Loading… All of Apple's Manual Pages for Server and Client OS are listed here: Loading… If you want a paper copy this command will create a pdf of a desired manual and save it to your desktop: man -t binaryofyourchoice | pstopdf -i -o ~/Desktop/dscl.pdf Where binaryofyourchoice could be sudo, su, dscl and so-on. If you want to see all the binaries (commands) installed simply launch Terminal and hold down the escape (esc) key. After a few seconds you should see "Display all xxxx possibilities? (y or n)." Simply type y and you'll see all the binaries listed. Depending on which OS you have the figure listed will be either more or less. Ironic that I end the previous sentence with more and less as these are two commands that are often used. Antonio Rocco (ACSA) Edited October 1, 2010 by AntonioRocco
Carter Posted October 1, 2010 Posted October 1, 2010 Even running sudo this does not fix why i get the message error that it will not work. Am I not filling in the server info correctly.
AntonioRocco Posted October 1, 2010 Posted October 1, 2010 @Carter Unless it's a typo it does not look like you've commented out the first line in your script. Antonio Rocco (ACSA)
Carter Posted October 1, 2010 Posted October 1, 2010 Now just to confirm if I can get the share to mount I'm running the following sudo -s mount_smbfs //$usrname@servername/home$/$usrname$ and I should be able to mount this from here should i not by hand by running in terminal? I still get the error "username" is not in the sudoers file Yet I can run from the "connect to server" option by putting in smb://servername/home$/username and it mounts without an issue
AntonioRocco Posted October 1, 2010 Posted October 1, 2010 Hi Try: sudo mount_smbfs //$usrname@servername/home$/$usrname$ Antonio Rocco (ACSA)
HodgeHi Posted October 3, 2010 Posted October 3, 2010 It sounds like the user you are running the command under is not allowed to run the sudo command. IE a standard AD networked account is not listed in the sudoers file. I don't know how to remedy this as i never bothered looking. But have seen this several times myself, unless or course you know the user should be able to use sudo in which case I'm not sure. Running the command as a local admin should give the correct results.
mac_shinobi Posted October 4, 2010 Posted October 4, 2010 (edited) Trying to look for something else I stumbled across this Mac OS X v10.5, 10.6: Network home directory may not mount if bound to Active Directory I was looking for the tickbox under directory services on 10.5 / 10.6 as you can check a box that will auto-magically mount the relevant users home area to the desktop although am not 100% sure if this is the same as what was suggested with ref to using workgroup manager on a client etc The first link / article below has what I am reffering to ref this section Exploring the “User Experience” Advanced Options Pane http://ptgmedia.pearsoncmg.com/images/chap4_9780321635327/elementLinks/04-11.jpg http://www.peachpit.com/articles/article.aspx?p=1431816 http://www.peachpit.com/articles/article.aspx?p=1431816&seqNum=2 Edited October 4, 2010 by mac_shinobi
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now