On 09/13/2005 03:19 PM, foxy123 wrote:
> I have got a desktop which is dual boot Windows/Ubuntu and laptop, which
> is run on Ubuntu only. I am trying to set up autofs to automatically mount
> the shares from desktop on laptop regardless how desktop is booted.
>
> I thought that auto.net script should look up available shares and mount
> them in /net. However, it does not happen. In my auto.master I've got the
> following:
>
> /net /etc/auto.net --timeout=60
>
> auto.net file contains some sort of script... Any help?
That auto.net script is only for NFS shares, and will not work for
Windows and, or Samba shares; based on this auto.net you may try my
auto.smb sript works for me:
------------8<------------
#!/bin/sh
# $Id: auto.net,v 1.5 2003/09/29 08:22:35 raven Exp $
# Look at what an host is sharing to determine what we can mount. This is
# very simple, but it appears to work surprisingly well.
key="$1"
# FIXME: Override a bug/feature in autofs; it's working for only me, but is
# genric enough to be usable by others
[ -z "$HOME" ] || HOME="/home/bsd"
# Get username from $HOME/.sambarc
usr=`awk -F= '/username/ {print $2}' $HOME/.sambarc`
# Add/edit other applicable smbfs/mount options here.
# Note: "nonstrict" is now set by default, remove it if you don't want it.
opts="-fstype=smbfs,credentials=$HOME/.sambarc,uid=$usr,gid=$usr,fmask=0664,dmask=0775,n onstrict"
# List samba/windows/lan manager shares available on target host (key).
LISTMOUNTS="/usr/bin/smbclient -A $HOME/.sambarc -L $key"
$LISTMOUNTS 2>/dev/null | LC_ALL=C sort +0 | \
awk -v key="$key" -v opts="$opts" -- '
BEGIN { ORS=""; first=1 }
{ if (first) { print opts; first=0 };
if ($2 == "Disk") {print " \\\n " "/mnt/" $1, "//" key "/" $1}}
END { if (!first) print "\n"; else exit 1 }
' | grep -v '\$'
------------8<------------
Create an /etc/auto.smb on your Ubuntu desktop and add the following
line to yout /etc/auto.master
/smb /etc/auto.smb --timeout=20 # or whatever
You will also need to create $HOME/.smabarc files on your Ubuntu
notebook containg the follows lines.
# .sambarc
username=UserNameOnYourUbuntuDesktop
password=SecretForAboveUser
Restart autofs service on your Ubuntu Notebook
invoke-rc.d autofs restart
and type in:
cd /smb/HostnameOfYourDesktop
Hope that helps!
--
Dr Balwinder Singh Dheeman Registered Linux User: #229709
CLLO (Chief Linux Learning Officer) Machines: #168573, 170593, 259192
Anu's Linux@HOME Distros: Ubuntu, Fedora, Knoppix
More:
http://anu.homelinux.net/~bsd/ Visit:
http://counter.li.org/