I see you have gotten no replies.
To mount my entire network, here is what I do. It's a script (bash) I
wrote a long time ago. It seems to still work.
#!/bin/bash
# I use a domain master browser for two subnets.
# If you have only one subnet you could use: nmblookup -M "-" | cut -d
" " -f1 instead
MASTER=$(nmblookup WORKGROUP#1b | grep -i \<1b\> | cut -d" " -f1
)
echo $MASTER
# This next statement is complicated
# It runs the output of smbclient -LN $MASTER through some filtering, including
# a sed script to get just the ip's of the hosts in the WORKGROUP
echo starting server search
servers=$(smbclient -NL $MASTER | tr -d "\011" | tr -s " " |
\
sed -n "{
/^Server/{ # search for line with Server
n # Skip line of dashes
:loop # Loop point
n # Read in new line
/^$/q # If blank line, all done
p # Out put line (to cut statement)
bloop # Branch back to loop
}
}" | cut -d" " -f1 )
echo $servers
# The for statement checks for the existance of the mount points
# and if they don't exist, makes them
# I am alway vague on permissions, but this works
# You can use whatever user and group you want
# Host HAMMER2 below is special and I kept the permissions different.
for i in $servers
do
echo "Checking out /mnt/NetWork/$i"
[ -d "/mnt/NetWork/$i" ] || {
mkdir /mnt/NetWork/$i
chown jlh.users /mnt/NetWork/$i
chmod 755 /mnt/NetWork/$i
echo Have created /mnt/Network/$i
}
[ $i = "HAMMER2" ] && chmod 700 /mnt/NetWork/$i
done
# This for statement then runs smbclient -LN against each host in the workgroup
# to get the shares on each host. It then makes a directory to mount each share
# Then, it mounts each share with the permission given.
# You might have to modify things to get passwords and other details right.
# If you can figure out just what this script is doing from this point on, let
me know
# since it get involved!
# There are some debugging messages left in.
echo Got Here
for i in $servers
do
echo Got even here
for j in `smbclient -L $i -N | grep Disk \
| sed 's/Disk.*//' | tr -d '\011' | sed 's/
*$//' \
| sed 's/.*/"&"/'`
do
echo $j
l=""
k="$m $j"
l=`echo $k | sed 's/\(.*\)\([^"]\)$//'`
if [ -z "$l" ];
then
m=$k
else m=""
n=`echo $k | sed 's/^ *//' | sed 's/"//g' `
echo Checking out /mnt/Network/$i/$n
[ -d "/mnt/NetWork/$i/$n" ] || mkdir
"/mnt/NetWork/$i/$n"
t=`mount | sed -n "/\/mnt\/NetWork\/$i\/$n/p"`
echo $t
# I don't mount the printer$ share. You can include others not to mount if
you like
[ -z "$t" ] && {
[ "$n" != printer$ ] && smbmount //$i/"$n"
/mnt/NetWork/$i/"$n" -o uid=jlh,gid=users,guest,rw,fmask=777
echo smbmount //$i/"$n" /mnt/NetWork/$i/"$n"
chown jlh.users "/mnt/NetWork/$i/$n"
chmod 755 "/mnt/NetWork/$i/$n"
}
fi
done
done
> Hi,
> Is it possible to mount the complete SMB tree (Network Neighborhood in MS
> Windows) to /smb for example? I currently only know how to mount individual
> shares. Thanks in advance,
> Z
> --
> To unsubscribe from this list go to the following URL and read the
> instructions: http://lists.samba.org/mailman/listinfo/samba