tvlad Posted October 20, 2002 Report Share Posted October 20, 2002 I know that i can acces a windows share by typing : smbount //share_name/dir. But i would like to know how i could mount everything that he is sharing.I mean : if he has 5 directorys shared, i want to mount them all let's say to /home. I tried with smbmount //share_name, but i also have to specify a dir, i can't just mount everything he's sharing. Quote Link to comment Share on other sites More sharing options...
Guest joehill Posted October 21, 2002 Report Share Posted October 21, 2002 have you tried using a wildcard, ie. smbount //share_name/* Quote Link to comment Share on other sites More sharing options...
tvlad Posted October 21, 2002 Author Report Share Posted October 21, 2002 I just tried that and it doesn't work, samba thinks that * is a directory that my friend is sharing. Quote Link to comment Share on other sites More sharing options...
Guest joehill Posted October 21, 2002 Report Share Posted October 21, 2002 pffffft...silly samba! Quote Link to comment Share on other sites More sharing options...
Guest southernguy Posted November 1, 2002 Report Share Posted November 1, 2002 I know that i can acces a windows share by typing :smbount //share_name/dir. But i would like to know how i could mount everything that he is sharing.I mean : if he has 5 directorys shared, i want to mount them all let's say to /home. I tried with smbmount //share_name, but i also have to specify a dir, i can't just mount everything he's sharing. why u dont just put the shares all in fstab with his machine have its own dir under /home/ but each share also have a dir? /home/winbox/share1 /home/winbox/share2 and so on? or write a script that mounts them all and when you want to mount them all just call the script. Quote Link to comment Share on other sites More sharing options...
tvlad Posted November 2, 2002 Author Report Share Posted November 2, 2002 True, i can do as you say, but i still want to know if it can be done in a single comand. Quote Link to comment Share on other sites More sharing options...
Guest DuoICE Posted December 29, 2002 Report Share Posted December 29, 2002 With a script like the following You should be able to mount Windows shares on request, even if You don't know all shares or even all machine names (but You must know the Administrator password on Win2000 machines): ---------------<BOF>------------------- :arrow: #!/bin/sh # get NETbios names that accesses eth0 (or whatever # interface Your LAN is connected with) from ARP-Table # This is done within he first awk program, that does not # prompt for input, since it gets none (input from null device) :arrow: awk 'BEGIN {while (("/sbin/arp -va"|getline) > 0) :arrow: if ($NF ~/eth0/) print $1; close("/sbin/arp -va")}' /dev/null | # ... separate <Machine.Workgroup> and print two #lines "Machine=<hostname>" and "Workgroup=<Workgroup>" #pipe output to awk to make directories for each windows host :arrow: awk 'BEGIN {FS="."} :arrow: {Machine=$1;Workgroup=$2 :arrow: system("mkdir -p /NetworkNeighborhood/"$1)}' #get the windows hosts from the newly reated directories, pipe to #awk once more (this script discards the workgroup names) :arrow: ls -l /NetworkNeighborhood|awk ' :arrow: {if ($1 ~ /^d.*/) { :arrow: Client=$NF :arrow: Shares = "/usr/bin/smbclient -UAdministrator%adminpassword -L "Client :arrow: while ((Shares| getline) > 0) :arrow: print "/"Client"/",$0 :arrow: close(Shares)} :arrow: }'| # The output of the smbclient utility is piped a last time to awk, # each line preceded by the windows host's name within slashes # so the sequence $1$1 holds /<hostname>/<sharename> # The awk program creates the moountpoints and mounts the # shares, discarding shares like ADMIN$, C$ in the if-condition :arrow: awk '$3~/[Dd]isk/ { if ($2~/[^$]$/) { :arrow: Clientshare=$1$2 :arrow: Mountpoint="/NetworkNeighborhood"Clientshare :arrow: system("mkdir -p "Mountpoint) :arrow: system("/usr/bin/smbmount /"Clientshare" "Mountpoint" -o username=Administrator%miez") :arrow: } :arrow: }' -----<EOF>---------- as root, copy that script to, let us say, /usr/bin/smbconnect (and get rid of those :arrow:s ). The SETUID-flag of the script must be set. Create a new KDE desktop Iconnamed "Network Neighborhood" as a link to a program. It should execute the command line "/usr/bin/smbconnect;konqueror "/NetworkNeighborhood". All together will do much the same as a doubleclick on the Network Neighborhood's icon on Your windows desktop. Another way would be to call that script on any login. BUGS: arp might fail when the connection(s) to the windows host(s) is/are idle for a while. Consider calling the smbconnect script in Your login script, when there was traffic from samba startup while booting. Don't call it before login, or all windows shares would belong to root for that session. You might want to remove the directories of all the windows shares when shutting down your linux box. DON'T FORGET to smbumount ALL SHARES befor You do that! Have fun... Quote Link to comment Share on other sites More sharing options...
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.