From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Jurgens Subject: Re: Not correctly mount SMB shares ending in $ Date: Sat, 13 Sep 2008 12:03:29 +1000 Message-ID: <48CB1F71.50407@edcint.co.nz> References: <48C5F518.9010800@edcint.co.nz> <1221018586.3030.63.camel@raven.themaw.net> <48C8D7FE.9000501@edcint.co.nz> <1221142584.28271.15.camel@raven.themaw.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6951816543634546730==" Return-path: In-Reply-To: <1221142584.28271.15.camel@raven.themaw.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autofs-bounces@linux.kernel.org Errors-To: autofs-bounces@linux.kernel.org To: Ian Kent Cc: "autofs@linux.kernel.org" This is a multi-part message in MIME format. --===============6951816543634546730== Content-Type: multipart/alternative; boundary="------------020108060700040501000703" This is a multi-part message in MIME format. --------------020108060700040501000703 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Ok, so I updated the script to the RPM version and added the authentication parts: #!/bin/bash # This file must be executable to work! chmod 755! key="$1" # key comes is as something like a hostname eg matthew opts="-fstype=cifs,username=$SMB_USER,password=$SMB_PASSWORD" smbauthfile=/tmp/smbauth.tmp cat << EOT > $smbauthfile username=$SMB_USER password=$SMB_PASSWORD EOT 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 -A $smbauthfile -gL $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 } ' Now its output is slightly different but the result is still the same -fstype=cifs,username=USER,password=PASSWORD \ "/C" "://xp0/C" \ "/ADMIN$" "://xp0/ADMIN\$" \ "/C$" "://xp0/C\$" vs the older output -fstype=cifs,username=USER,password=PASSWORD \ /C "://xp0/C" \ /ADMIN\$ "://xp0/ADMIN\$" \ /C\$ "://xp0/C\$" mount: //xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand) > > That doesn't look quite right. > It might be an out of date script, how about posting the script as well > > --------------020108060700040501000703 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Ok, so I updated the script to the RPM version and added the authentication parts:

#!/bin/bash

# This file must be executable to work! chmod 755!
key="$1" # key comes is as something like a hostname eg matthew
opts="-fstype=cifs,username=$SMB_USER,password=$SMB_PASSWORD"

smbauthfile=/tmp/smbauth.tmp
cat << EOT > $smbauthfile
username=$SMB_USER
password=$SMB_PASSWORD
EOT

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 -A $smbauthfile -gL $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 }
        '



Now its output is slightly different but the result is still the same
-fstype=cifs,username=USER,password=PASSWORD \
         "/C" "://xp0/C" \
         "/ADMIN$" "://xp0/ADMIN\$" \
         "/C$" "://xp0/C\$"

vs the older output
-fstype=cifs,username=USER,password=PASSWORD \
         /C "://xp0/C" \
         /ADMIN\$ "://xp0/ADMIN\$" \
         /C\$ "://xp0/C\$"
mount:
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)



That doesn't look quite right.
It might be an out of date script, how about posting the script as well
  

--------------020108060700040501000703-- --===============6951816543634546730== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ autofs mailing list autofs@linux.kernel.org http://linux.kernel.org/mailman/listinfo/autofs --===============6951816543634546730==--