Hi! I'm having trouble accessing Samba shares via autofs. Let me begin by saying that I can access the samba shares directly using smbclient without any trouble. For example: smbclient //Matsa/Pisi works fine. I first started out by copying a config line from an older system (redhat 7) that has in its auto.misc: (all on one line, of course) pisi -fstype=smb,guest,uid=501,gid=100,username=guest,fmask=666,dmask=777 ://Matsa/Pisi On my current system this does not work: # cd /misc/pisi bash: cd: /misc/pisi: No such file or directory Then, I realized there is this mechanism for dynamically finding smb shares in the latest autofs, so I added to auto.master /smb /etc/auto.smb --timeout=60 and got the following results: # ls /smb/Matsa Hammer Matsa Pisi print$ SharedDocs Simple # ls /smb/Matsa/Pisi ls: cannot open directory /smb/Matsa/Pisi: No such file or directory None of the logs (/var/log/messages and /var/log/samba/*) have any entries. This is a new Fedora 11 install. autofs version: autofs-5.0.4-38 samba version: samba-3.3.2-0.33.fc11 If it would help, here is what happens when I evoke auto.smb: # /etc/auto.smb Matsa -fstype=cifs \ "/Simple" "://Matsa/Simple" \ "/Matsa" "://Matsa/Matsa" \ "/SharedDocs" "://Matsa/SharedDocs" \ "/print$" "://Matsa/print\$" \ "/Pisi" "://Matsa/Pisi" \ "/Hammer" "://Matsa/Hammer" And here are the contents of the actual file /etc/auto.smb: #!/bin/bash # This file must be executable to work! chmod 755! key="$1" opts="-fstype=cifs" for P in /bin /sbin /usr/bin /usr/sbin do if [ -x $P/smbclient ] then SMBCLIENT=$P/smbclient break fi done [ -x $SMBCLIENT ] || exit 1 $SMBCLIENT -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts" -F'|' -- ' BEGIN { ORS=""; first=1 } /Disk/ { if (first) print opts; first=0 dir = $2 loc = $2 # Enclose mount dir and location in quotes # Double quote "$" in location as it is special gsub(/\$$/, "\\$", loc); print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\"" } END { if (!first) print "\n"; else exit 1 } ' I also tried adding some options to the above script: opts="-fstype=smb,guest,uid=501,gid=100,username=guest,fmask=666,dmask=777,file_mode=0666,dir_mode=0777" but it did not help. Any suggestions would be greatly appreciated! I tried reading the manuals and doing web searches, but couldn't find out what I was doing wrong. Ian
One more piece of information: when trying to mount explicitly (without autofs) I have the following problem: mount -t cifs //Matsa/Pisi /mnt/matsa --verbose -o guest,user=guest,uid=501,gid=100,file_mode=0666,dir_mode=0777,domain=WORKGROUP results in mount error: could not resolve address for Matsa: Name or service not known No ip address specified and hostname not found As before, smbclient //Matsa/Pisi seems to have no trouble with the IP Ian Ian Shay wrote:> Hi! > I'm having trouble accessing Samba shares via autofs. > > Let me begin by saying that I can access the samba shares > directly using smbclient without any trouble. For example: > smbclient //Matsa/Pisi > works fine. > > I first started out by copying a config line from an older > system (redhat 7) that has in its auto.misc: > (all on one line, of course) > > pisi > -fstype=smb,guest,uid=501,gid=100,username=guest,fmask=666,dmask=777 > ://Matsa/Pisi > > On my current system this does not work: > # cd /misc/pisi > bash: cd: /misc/pisi: No such file or directory > > Then, I realized there is this mechanism for dynamically > finding smb shares in the latest autofs, so I added to > auto.master > /smb /etc/auto.smb --timeout=60 > and got the following results: > # ls /smb/Matsa > Hammer Matsa Pisi print$ SharedDocs Simple > # ls /smb/Matsa/Pisi > ls: cannot open directory /smb/Matsa/Pisi: No such file or > directory > > None of the logs (/var/log/messages and /var/log/samba/*) > have any entries. > > This is a new Fedora 11 install. > autofs version: autofs-5.0.4-38 > samba version: samba-3.3.2-0.33.fc11 > > If it would help, here is what happens when I evoke auto.smb: > # /etc/auto.smb Matsa > -fstype=cifs \ > "/Simple" "://Matsa/Simple" \ > "/Matsa" "://Matsa/Matsa" \ > "/SharedDocs" "://Matsa/SharedDocs" \ > "/print$" "://Matsa/print\$" \ > "/Pisi" "://Matsa/Pisi" \ > "/Hammer" "://Matsa/Hammer" > > And here are the contents of the actual file /etc/auto.smb: > #!/bin/bash > > # This file must be executable to work! chmod 755! > > key="$1" > opts="-fstype=cifs" > > for P in /bin /sbin /usr/bin /usr/sbin > do > if [ -x $P/smbclient ] > then > SMBCLIENT=$P/smbclient > break > fi > done > > [ -x $SMBCLIENT ] || exit 1 > > $SMBCLIENT -gNL $key 2>/dev/null| awk -v key="$key" -v > opts="$opts" -F'|' -- ' > BEGIN { ORS=""; first=1 } > /Disk/ { > if (first) > print opts; first=0 > dir = $2 > loc = $2 > # Enclose mount dir and location in quotes > # Double quote "$" in location as it is > special > gsub(/\$$/, "\\$", loc); > print " \\\n\t \"/" dir "\"", "\"://" key > "/" loc "\"" > } > END { if (!first) print "\n"; else exit 1 } > ' > > I also tried adding some options to the above script: > opts="-fstype=smb,guest,uid=501,gid=100,username=guest,fmask=666,dmask=777,file_mode=0666,dir_mode=0777" > > > but it did not help. > > Any suggestions would be greatly appreciated! I tried > reading the manuals and doing web searches, but couldn't > find out what I was doing wrong. > > Ian
Ian Shay kirjoitti:> One more piece of information: when trying to mount explicitly (without > autofs) > I have the following problem: > > mount -t cifs //Matsa/Pisi /mnt/matsa --verbose -o > guest,user=guest,uid=501,gid=100,file_mode=0666,dir_mode=0777,domain=WORKGROUP > > > results in > > mount error: could not resolve address for Matsa: Name or service not known > No ip address specified and hostname not found > > As before, smbclient //Matsa/Pisi seems to have no trouble with the IPThink that smbclient is using other methods for netbios name resolving, maybe you can try //matsa.full.dns.name or //ip.address -- Eero, RHCE
> Think that smbclient is using other methods for netbios name resolving,> maybe you can try //matsa.full.dns.name or //ip.address Wow, this seems unfortunate that mount.cifs does not honour smb.conf. At any rate, I cannot use what you are suggesting because the IP addresses are DHCP-assigned and the Linksys router that does the DHCP does not do DNS; it supplies an external DNS server, which of course won't work. So, given that I don't want to go through the process of giving static IPs and editing fstab or auto.misc every time a new laptop is temporarily added to the network, is there a way to have mount.cifs use BCAST as a way of resolving names? Furthermore, this was NOT a problem on the older Linux box that I am trying to replace (it has redhat 7 and some older version of samba). What can I do to get at least the same level of functionality as the old one had? Ian
Well maybe it's a good idea to look at some constructions I've made, just to automate the proces of making use of the windows network, using native cifs and the automounter. I'm using the utility nbtscan (or ip and nmblookup) to detect all the SMB hosts, and smblient to detect all the shares an user has access to. The first construction creates complete multi mount maps dynamically when a user logs in and the session for her/him starts. This map file and mountpoint are added to the auto.master file dynamically, and there is only one automounter running. Just after the auto.master file is changed when a session ends, but also when it ends, this automounter gets a reload signal to make the changes visible. This worked but, had some serious drawbacks. The automounter regulary just stopped running after a reload signal, while the maps were not empty. And this construction makes use of multimount maps, which are not flexible when it comes to changes. When a SMB host/server is new to the network, and it's discovered by scripts, it's not easy to make this change visisble to an already running automounter. Even a reload signal was not sufficient. This is caused by the static multimount maps. Look at: http://linux.bononline.nl/linux/autofsmanaged/index.php A second construction make use of a fuse module I created. With the first construction the automounted mountpoints are in the user homedirectory, now it at a central place /mnt/network-autofs. And there is a daemon running for every user. This is neccesary to stay secure, but I'm not sure yet there is another sollution. The automounter works with a very basis setup, and is not intended to be accessed directly by the userm but through an interface, and that's the fuse module. Look at: http://linux.bononline.nl/linux/fuse-workspace/index.php I hope this might interest you. If so email me, I'm very interested in any feedback. But what do you mean by not being able putting smb shares in auto.misc?? Sure you can. Stef Bon Ian wrote:> Thank you, Stef, I'm sure this will fix it. I will try it this > weekend. I still won't be able to put SMB shares as entries in > auto.misc, but I can live with that. > > Ian > > Stef Bon wrote: >> Hello, >> >> mounting with cifs requires an extra option for the ip. >> >> Some time ago I've had the same problem with the auto.smb script in >> the autofs package, >> and proposed modifications, simply when using the filesystem cifs, do >> a lookup with the utility >> nmblookup like: >> >> ipaddress=$($NMBLOOKUP $key --debug-level=0 2>>/dev/null | grep >> '<00>' | awk '{ print $1 }') >> >> add the found ip address to the options like: >> >> opts="-fstype=cifs,guest,ip=$ipaddress" >> >> If no ip is found you can exit with an errorcode or continue and >> mount without ip, but will propably also exit with error, because >> that does not work. >> >> >> Attached the modified file. The patch never made it to the source... >> >> >> Hope it's of any help. >> >> Stef Bon >> the Netherlands >> >> ps the name of the attached file is auto.smb.orig, rename this to >> auto.smb and replace the old one with this. >> >> >> >> Ian Shay wrote: >>> >>> > Think that smbclient is using other methods for netbios name >>> resolving, >>> > maybe you can try //matsa.full.dns.name or //ip.address >>> >>> Wow, this seems unfortunate that mount.cifs does not honour >>> smb.conf. At any rate, I cannot use what you are suggesting because >>> the IP addresses are DHCP-assigned and the Linksys router that does >>> the DHCP does not do DNS; it supplies an external DNS server, which >>> of course won't work. >>> >>> So, given that I don't want to go through the process of giving >>> static IPs and editing fstab or auto.misc every time a new laptop is >>> temporarily added to the network, is there a way to have mount.cifs >>> use BCAST as a way of resolving names? >>> >>> Furthermore, this was NOT a problem on the older Linux box that I am >>> trying to replace (it has redhat 7 and some older version of samba). >>> What can I do to get at least the same level of functionality as the >>> old one had? >>> >>> Ian >> >