Samba Network Shares with Nautilus in Hardy Heron Part 2
Posted by Ryan Baxter Sun, 01 Jun 2008 23:07:00 GMT
Nearly a month ago I wrote about my problems connecting to the network shares of my Linksys NAS200 using Nautilus in Ubuntu, Hardy Heron. My fix was simple and it worked. Unfortunately, the solution’s WAF (Wife Acceptance Factor) was low. Apparently she didn’t think it was easy enough to execute smbmount from a Terminal window. Whatever :) I have since written a small shell script that is called from Session Startup.
Initially, the script failed to connect to my network shares because my wireless network connection hadn’t finished negotiating before the script was executed. I coded around this by creating a while loop that greps the output of a ping to my router. If successful, the mount_shares function is called. Otherwise. the thread will sleep for 10 seconds and try again.
#!/bin/bash
user="thorbardin/ryan%password"
root_dir="/home/ryan/Network Shares"
mount_shares() {
public_dir="$root_dir"/"Public on Thorbardin"
home_dir="$root_dir"/"Home on Thorbardin"
[ -d "$public_dir" ] || mkdir -p "$public_dir"
[ -d "$home_dir" ] || mkdir -p "$home_dir"
smbmount "//192.168.1.105/public disk" "$public_dir" -o user="$user"
smbmount "//192.168.1.105/ryan" "$home_dir" -o user="$user"
}
while [ 1 ]; do
if ping -c2 192.168.1.1 2>&1 | grep ttl; then
mount_shares
exit 0
fi
sleep 10
done
exit 0I’m already thinking about rewriting this script so that it scans my network using smbtree and automatically mounts all available network shares. That’ll be Part 3!
- Posted in Code Snippets
- Meta no trackbacks, 3 comments, permalink, rss, atom
Trackbacks
Use the following link to trackback from your own site:
http://crunchlife.com/articles/trackback/67
Comments
9 days later:
9 days later:
11 days later:

