Adam Shand wrote: > > >The smbmount command can't locate any servers by their name (it works > >with the IP -- also, smbclient does work w/ names). I think this has > >something to do w/ netbios. Anyone know how to get this to work? > > This does work, however the catch is that the netbios name must match the > DNS hostname. So if it's DNS name is 'pinky.domain.net' then the windows > name for the same computer must be 'pinky'. [ other admonishment cut ]
And you people call yourself unix users!! You oughta be ashamed! ;) What ever happened to good, old-fashioned ingenuity! Yes, smbmount uses gethostbyname() rather than doing a Lan Manager name lookup. But no, that doesn't mean (which I believe another respondent unintentionally implied) that the DNS name *has* to match the netbios name. This can cause problems because the server's name is embedded in the mount request and is be rejected if it doesn't match the server's name. (Which is to say, if you use the IP address rather than the DNS name, and pass the server name as a '-s' argument, you'll be a-ok). Anyway, I've attached a short perl script which you may use as a replacement for smbmount which will do the NMB lookup itself. -- Jens B. Jorgensen [EMAIL PROTECTED]
#!/usr/bin/perl # check args die `smbmount -h` if ($#ARGV < 1); # parse out server name, share name, and mount point ($ARGV[0] =~ '^//([^/]+)/(.+)');# || die `smbmount -h`; $server = $1; $share = $2; $mntpoint = $ARGV[1]; # use nmblookup to find IP address for the target server open(INFILE, "/usr/bin/nmblookup $server |"); while (<INFILE>) { chop; if ($_ =~ '^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+) .+') { $serverip = "${1}.${2}.${3}.${4}"; } } do { print "unknown host $server\n"; exit 1; } unless $serverip; # in NetBIOS land, all hostnames are ALL CAPS $server = uc($server); # now just run the whole command $cmd = "/usr/bin/smbmount //${serverip}/$share $mntpoint -s$server"; if ($#ARGV > 1) { $cmd .= " " . join(' ', @ARGV[2..$#ARGV]); } exit system($cmd) / 256;