Skip to contentSkip to conversation

unable to automount windows C$

DISCUSSION Scott Belnap 4 participants 30 messages Dec 10, 2008 – Jun 11, 2009 3 messages not in the archive Kernel automounter

lore
Share & tools
lore
#0 lore raw

I'm trying to automount a windows machine. I am able to automount any directory that doesn't have a $ in the mount name. Looks like the parse_mount method is stripping out the $ from the mount name. Any ideas on how to fix this?

Dec  9 23:49:03 dc2 automount[19084]: handle_packet_missing_direct: token
122, name /cifs/laptop/C$, request pid 17857
Dec  9 23:49:03 dc2 automount[19084]: attempting to mount entry
/cifs/laptop/C$
Dec  9 23:49:03 dc2 automount[19084]: lookup_mount: lookup(program):
/cifs/laptop/C$ ->
-fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop
://laptop/C$
Dec  9 23:49:03 dc2 automount[19084]: parse_mount: parse(sun): expanded
entry:
-fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop
://laptop/C
Dec  9 23:49:03 dc2 automount[19084]: parse_mount: parse(sun): gathered
options:
fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop
Dec  9 23:49:03 dc2 automount[19084]: parse_mount: parse(sun): core of
entry:
options=fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop,
loc=://laptop/C
Dec  9 23:49:03 dc2 automount[19084]: sun_mount: parse(sun): mounting root
/cifs, mountpoint /cifs/laptop/C$, what //laptop/C, fstype cifs, options
file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop
Dec  9 23:49:03 dc2 automount[19084]: do_mount: //laptop/C
/cifs//cifs/laptop/C$ type cifs options
file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop using module
generic
Dec  9 23:49:03 dc2 automount[19084]: mount_mount: mount(generic): calling
mkdir_path /cifs/laptop/C$
Dec  9 23:49:03 dc2 automount[19084]: mount_mount: mount(generic): calling
mount -t cifs -s -o
file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop //laptop/C
/cifs/laptop/C$
Dec  9 23:49:03 dc2 kernel:  CIFS VFS: cifs_mount failed w/return code = -6
Dec  9 23:49:03 dc2 automount[19084]: >> retrying with upper case share name
Dec  9 23:49:03 dc2 kernel:  CIFS VFS: cifs_mount failed w/return code = -6
Dec  9 23:49:03 dc2 automount[19084]: >> mount error 6 = No such device or
address
Dec  9 23:49:03 dc2 automount[19084]: >> Refer to the mount.cifs(8) manual
page (e.g.man mount.cifs)
Dec  9 23:49:03 dc2 automount[19084]: spawn_mount: mount failed with error
code 16, retrying with the -f option
Dec  9 23:49:06 dc2 automount[19084]: >> unknown mount option f
Dec  9 23:49:06 dc2 automount[19084]: >> Usage:  /sbin/mount.cifs
<remotetarget> <dir> -o <options>
Dec  9 23:49:06 dc2 automount[19084]: >> Mount the remote target, specified
as a UNC name, to a local directory.
Dec  9 23:49:06 dc2 automount[19084]: >> Options:
Dec  9 23:49:06 dc2 automount[19084]: >> #011user=<arg>
Dec  9 23:49:06 dc2 automount[19084]: >> #011pass=<arg>
Dec  9 23:49:06 dc2 automount[19084]: >> #011dom=<arg>
Dec  9 23:49:06 dc2 automount[19084]: >> Less commonly used options:
Dec  9 23:49:06 dc2 automount[19084]: >>
#011credentials=<filename>,guest,perm,noperm,setuids,nosetuids,rw,ro,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011sep=<char>,iocharset=<codepage>,suid,nosuid,exec,noexec,serverino,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011directio,mapchars,nomapchars,nolock,servernetbiosname=<SRV_RFC1001NAME>
Dec  9 23:49:06 dc2 automount[19084]: >> Options not needed for servers
supporting CIFS Unix extensions
Dec  9 23:49:06 dc2 automount[19084]: >> #011(e.g. unneeded for mounts to
most Samba versions):
Dec  9 23:49:06 dc2 automount[19084]: >>
#011uid=<uid>,gid=<gid>,dir_mode=<mode>,file_mode=<mode>,sfu
Dec  9 23:49:06 dc2 automount[19084]: >> Rarely used options:
Dec  9 23:49:06 dc2 automount[19084]: >>
#011port=<tcpport>,rsize=<size>,wsize=<size>,unc=<unc_name>,ip=<ip_address>,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011dev,nodev,nouser_xattr,netbiosname=<OUR_RFC1001NAME>,hard,soft,intr,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011nointr,ignorecase,noposixpaths,noacl
Dec  9 23:49:06 dc2 automount[19084]: >> Options are described in more
detail in the manual page
Dec  9 23:49:06 dc2 automount[19084]: >> #011man 8 mount.cifs
Dec  9 23:49:06 dc2 automount[19084]: >> To display the version number of
the mount helper:
Dec  9 23:49:06 dc2 automount[19084]: >> #011/sbin/mount.cifs -V
Dec  9 23:49:06 dc2 automount[19084]: mount(generic): failed to mount
//laptop/C (type cifs) on /cifs/laptop/C$
Dec  9 23:49:06 dc2 automount[19084]: send_fail: token = 122
Dec  9 23:49:06 dc2 automount[19084]: handle_packet: type = 5
Dec  9 23:49:06 dc2 automount[19084]: handle_packet_missing_direct: token
123, name /cifs/laptop/C$, request pid 17857
Dec  9 23:49:06 dc2 automount[19084]: attempting to mount entry
/cifs/laptop/C$
Dec  9 23:49:06 dc2 automount[19084]: failed to mount /cifs/laptop/C$
Dec  9 23:49:06 dc2 automount[19084]: send_fail: token = 123
Dec  9 23:49:06 dc2 automount[19084]: failed to mount /cifs/laptop/C$

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

maintainer
#1 lore raw
Quoted 4 lines · Scott Belnap

I'm trying to automount a windows machine. I am able to automount any directory that doesn't have a $ in the mount name. Looks like the parse_mount method is stripping out the $ from the mount name. Any ideas on how to fix this?

I think you might need to escape the $ that gets clobbered. It is most likely getting interpreted as a dollar macro expansion.

Quoted 92 lines
Dec  9 23:49:03 dc2 automount[19084]: handle_packet_missing_direct:
token 122, name /cifs/laptop/C$, request pid 17857
Dec  9 23:49:03 dc2 automount[19084]: attempting to mount
entry /cifs/laptop/C$
Dec  9 23:49:03 dc2 automount[19084]: lookup_mount:
lookup(program): /cifs/laptop/C$ ->
-fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop ://laptop/C$
Dec  9 23:49:03 dc2 automount[19084]: parse_mount: parse(sun):
expanded entry:
-fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop ://laptop/C
Dec  9 23:49:03 dc2 automount[19084]: parse_mount: parse(sun):
gathered options:
fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop
Dec  9 23:49:03 dc2 automount[19084]: parse_mount: parse(sun): core of
entry:
options=fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop, loc=://laptop/C
Dec  9 23:49:03 dc2 automount[19084]: sun_mount: parse(sun): mounting
root /cifs, mountpoint /cifs/laptop/C$, what //laptop/C, fstype cifs,
options file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop
Dec  9 23:49:03 dc2 automount[19084]:
do_mount: //laptop/C /cifs//cifs/laptop/C$ type cifs options
file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop using
module generic
Dec  9 23:49:03 dc2 automount[19084]: mount_mount: mount(generic):
calling mkdir_path /cifs/laptop/C$
Dec  9 23:49:03 dc2 automount[19084]: mount_mount: mount(generic):
calling mount -t cifs -s -o
file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop //laptop/C /cifs/laptop/C$
Dec  9 23:49:03 dc2 kernel:  CIFS VFS: cifs_mount failed w/return code
= -6
Dec  9 23:49:03 dc2 automount[19084]: >> retrying with upper case
share name
Dec  9 23:49:03 dc2 kernel:  CIFS VFS: cifs_mount failed w/return code
= -6
Dec  9 23:49:03 dc2 automount[19084]: >> mount error 6 = No such
device or address
Dec  9 23:49:03 dc2 automount[19084]: >> Refer to the mount.cifs(8)
manual page (e.g.man mount.cifs)
Dec  9 23:49:03 dc2 automount[19084]: spawn_mount: mount failed with
error code 16, retrying with the -f option
Dec  9 23:49:06 dc2 automount[19084]: >> unknown mount option f
Dec  9 23:49:06 dc2 automount[19084]: >> Usage:  /sbin/mount.cifs
<remotetarget> <dir> -o <options>
Dec  9 23:49:06 dc2 automount[19084]: >> Mount the remote target,
specified as a UNC name, to a local directory.
Dec  9 23:49:06 dc2 automount[19084]: >> Options:
Dec  9 23:49:06 dc2 automount[19084]: >> #011user=<arg>
Dec  9 23:49:06 dc2 automount[19084]: >> #011pass=<arg>
Dec  9 23:49:06 dc2 automount[19084]: >> #011dom=<arg>
Dec  9 23:49:06 dc2 automount[19084]: >> Less commonly used options:
Dec  9 23:49:06 dc2 automount[19084]: >>
#011credentials=<filename>,guest,perm,noperm,setuids,nosetuids,rw,ro,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011sep=<char>,iocharset=<codepage>,suid,nosuid,exec,noexec,serverino,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011directio,mapchars,nomapchars,nolock,servernetbiosname=<SRV_RFC1001NAME>
Dec  9 23:49:06 dc2 automount[19084]: >> Options not needed for
servers supporting CIFS Unix extensions
Dec  9 23:49:06 dc2 automount[19084]: >> #011(e.g. unneeded for mounts
to most Samba versions):
Dec  9 23:49:06 dc2 automount[19084]: >>
#011uid=<uid>,gid=<gid>,dir_mode=<mode>,file_mode=<mode>,sfu
Dec  9 23:49:06 dc2 automount[19084]: >> Rarely used options:
Dec  9 23:49:06 dc2 automount[19084]: >>
#011port=<tcpport>,rsize=<size>,wsize=<size>,unc=<unc_name>,ip=<ip_address>,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011dev,nodev,nouser_xattr,netbiosname=<OUR_RFC1001NAME>,hard,soft,intr,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011nointr,ignorecase,noposixpaths,noacl
Dec  9 23:49:06 dc2 automount[19084]: >> Options are described in more
detail in the manual page
Dec  9 23:49:06 dc2 automount[19084]: >> #011man 8 mount.cifs
Dec  9 23:49:06 dc2 automount[19084]: >> To display the version number
of the mount helper:
Dec  9 23:49:06 dc2 automount[19084]: >> #011/sbin/mount.cifs -V
Dec  9 23:49:06 dc2 automount[19084]: mount(generic): failed to
mount //laptop/C (type cifs) on /cifs/laptop/C$
Dec  9 23:49:06 dc2 automount[19084]: send_fail: token = 122
Dec  9 23:49:06 dc2 automount[19084]: handle_packet: type = 5
Dec  9 23:49:06 dc2 automount[19084]: handle_packet_missing_direct:
token 123, name /cifs/laptop/C$, request pid 17857
Dec  9 23:49:06 dc2 automount[19084]: attempting to mount
entry /cifs/laptop/C$
Dec  9 23:49:06 dc2 automount[19084]: failed to mount /cifs/laptop/C$
Dec  9 23:49:06 dc2 automount[19084]: send_fail: token = 123
Dec  9 23:49:06 dc2 automount[19084]: failed to mount /cifs/laptop/C$

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

#2 lore raw

I've had this same problem from time to time and since upgrading to Fedora 10 it has come back:
Fedora 10 - kernel 2.6.27.21-170.2.56.fc10.i686.PAE
autofs-5.0.3-41.i386

The correctly mounted manual entry:
//xp0/C$ on /mnt type cifs (rw,mand)

The autofs entry:
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)

If you need anymore debug info let me know

Quoted 99 lines · Ian Kent
Quoted 5 lines · Scott Belnap

I'm trying to automount a windows machine. I am able to automount any directory that doesn't have a $ in the mount name. Looks like the parse_mount method is stripping out the $ from the mount name. Any ideas on how to fix this?

I think you might need to escape the $ that gets clobbered. It is most likely getting interpreted as a dollar macro expansion.

Quoted 87 lines
Dec  9 23:49:03 dc2 automount[19084]: handle_packet_missing_direct:
token 122, name /cifs/laptop/C$, request pid 17857
Dec  9 23:49:03 dc2 automount[19084]: attempting to mount
entry /cifs/laptop/C$
Dec  9 23:49:03 dc2 automount[19084]: lookup_mount:
lookup(program): /cifs/laptop/C$ ->
-fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop ://laptop/C$
Dec  9 23:49:03 dc2 automount[19084]: parse_mount: parse(sun):
expanded entry:
-fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop ://laptop/C
Dec  9 23:49:03 dc2 automount[19084]: parse_mount: parse(sun):
gathered options:
fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop
Dec  9 23:49:03 dc2 automount[19084]: parse_mount: parse(sun): core of
entry:
options=fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop, loc=://laptop/C
Dec  9 23:49:03 dc2 automount[19084]: sun_mount: parse(sun): mounting
root /cifs, mountpoint /cifs/laptop/C$, what //laptop/C, fstype cifs,
options file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop
Dec  9 23:49:03 dc2 automount[19084]:
do_mount: //laptop/C /cifs//cifs/laptop/C$ type cifs options
file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop using
module generic
Dec  9 23:49:03 dc2 automount[19084]: mount_mount: mount(generic):
calling mkdir_path /cifs/laptop/C$
Dec  9 23:49:03 dc2 automount[19084]: mount_mount: mount(generic):
calling mount -t cifs -s -o
file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop //laptop/C /cifs/laptop/C$
Dec  9 23:49:03 dc2 kernel:  CIFS VFS: cifs_mount failed w/return code
= -6
Dec  9 23:49:03 dc2 automount[19084]: >> retrying with upper case
share name
Dec  9 23:49:03 dc2 kernel:  CIFS VFS: cifs_mount failed w/return code
= -6
Dec  9 23:49:03 dc2 automount[19084]: >> mount error 6 = No such
device or address
Dec  9 23:49:03 dc2 automount[19084]: >> Refer to the mount.cifs(8)
manual page (e.g.man mount.cifs)
Dec  9 23:49:03 dc2 automount[19084]: spawn_mount: mount failed with
error code 16, retrying with the -f option
Dec  9 23:49:06 dc2 automount[19084]: >> unknown mount option f
Dec  9 23:49:06 dc2 automount[19084]: >> Usage:  /sbin/mount.cifs
<remotetarget> <dir> -o <options>
Dec  9 23:49:06 dc2 automount[19084]: >> Mount the remote target,
specified as a UNC name, to a local directory.
Dec  9 23:49:06 dc2 automount[19084]: >> Options:
Dec  9 23:49:06 dc2 automount[19084]: >> #011user=<arg>
Dec  9 23:49:06 dc2 automount[19084]: >> #011pass=<arg>
Dec  9 23:49:06 dc2 automount[19084]: >> #011dom=<arg>
Dec  9 23:49:06 dc2 automount[19084]: >> Less commonly used options:
Dec  9 23:49:06 dc2 automount[19084]: >>
#011credentials=<filename>,guest,perm,noperm,setuids,nosetuids,rw,ro,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011sep=<char>,iocharset=<codepage>,suid,nosuid,exec,noexec,serverino,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011directio,mapchars,nomapchars,nolock,servernetbiosname=<SRV_RFC1001NAME>
Dec  9 23:49:06 dc2 automount[19084]: >> Options not needed for
servers supporting CIFS Unix extensions
Dec  9 23:49:06 dc2 automount[19084]: >> #011(e.g. unneeded for mounts
to most Samba versions):
Dec  9 23:49:06 dc2 automount[19084]: >>
#011uid=<uid>,gid=<gid>,dir_mode=<mode>,file_mode=<mode>,sfu
Dec  9 23:49:06 dc2 automount[19084]: >> Rarely used options:
Dec  9 23:49:06 dc2 automount[19084]: >>
#011port=<tcpport>,rsize=<size>,wsize=<size>,unc=<unc_name>,ip=<ip_address>,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011dev,nodev,nouser_xattr,netbiosname=<OUR_RFC1001NAME>,hard,soft,intr,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011nointr,ignorecase,noposixpaths,noacl
Dec  9 23:49:06 dc2 automount[19084]: >> Options are described in more
detail in the manual page
Dec  9 23:49:06 dc2 automount[19084]: >> #011man 8 mount.cifs
Dec  9 23:49:06 dc2 automount[19084]: >> To display the version number
of the mount helper:
Dec  9 23:49:06 dc2 automount[19084]: >> #011/sbin/mount.cifs -V
Dec  9 23:49:06 dc2 automount[19084]: mount(generic): failed to
mount //laptop/C (type cifs) on /cifs/laptop/C$
Dec  9 23:49:06 dc2 automount[19084]: send_fail: token = 122
Dec  9 23:49:06 dc2 automount[19084]: handle_packet: type = 5
Dec  9 23:49:06 dc2 automount[19084]: handle_packet_missing_direct:
token 123, name /cifs/laptop/C$, request pid 17857
Dec  9 23:49:06 dc2 automount[19084]: attempting to mount
entry /cifs/laptop/C$
Dec  9 23:49:06 dc2 automount[19084]: failed to mount /cifs/laptop/C$
Dec  9 23:49:06 dc2 automount[19084]: send_fail: token = 123
Dec  9 23:49:06 dc2 automount[19084]: failed to mount /cifs/laptop/C$
Quoted 12 lines
Quoted 5 lines

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

maintainer
#3 lore raw
Quoted 5 lines · Matthew Jurgens

I've had this same problem from time to time and since upgrading to Fedora 10 it has come back:
Fedora 10 - kernel 2.6.27.21-170.2.56.fc10.i686.PAE autofs-5.0.3-41.i386

Quoted 7 lines

The correctly mounted manual entry:
//xp0/C$ on /mnt type cifs (rw,mand)

The autofs entry:
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)

If you need anymore debug info let me know

I have no idea what you are trying to say.
The above, //xp0/C/$, doesn't correspond to what autofs-5.0.3-41 passes to mount(8) and I have no idea what has happened since you haven't provided any log information.

Quoted 121 lines
Quoted 118 lines · Ian Kent
Quoted 5 lines · Scott Belnap

I'm trying to automount a windows machine. I am able to automount any directory that doesn't have a $ in the mount name. Looks like the parse_mount method is stripping out the $ from the mount name. Any ideas on how to fix this?

I think you might need to escape the $ that gets clobbered. It is most likely getting interpreted as a dollar macro expansion.

Quoted 94 lines
Dec  9 23:49:03 dc2 automount[19084]: handle_packet_missing_direct:
token 122, name /cifs/laptop/C$, request pid 17857
Dec  9 23:49:03 dc2 automount[19084]: attempting to mount
entry /cifs/laptop/C$
Dec  9 23:49:03 dc2 automount[19084]: lookup_mount:
lookup(program): /cifs/laptop/C$ ->
-fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop
://laptop/C$
Dec  9 23:49:03 dc2 automount[19084]: parse_mount: parse(sun):
expanded entry:
-fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop
://laptop/C
Dec  9 23:49:03 dc2 automount[19084]: parse_mount: parse(sun):

gathered options:
fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop

Dec  9 23:49:03 dc2 automount[19084]: parse_mount: parse(sun): core of
entry:
options=fstype=cifs,file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop,
loc=://laptop/C
Dec  9 23:49:03 dc2 automount[19084]: sun_mount: parse(sun): mounting
root /cifs, mountpoint /cifs/laptop/C$, what //laptop/C, fstype cifs,
options file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop
Dec  9 23:49:03 dc2 automount[19084]:
do_mount: //laptop/C /cifs//cifs/laptop/C$ type cifs options
file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop using
module generic
Dec  9 23:49:03 dc2 automount[19084]: mount_mount: mount(generic):
calling mkdir_path /cifs/laptop/C$
Dec  9 23:49:03 dc2 automount[19084]: mount_mount: mount(generic):
calling mount -t cifs -s -o
file_mode=0644,dir_mode=0755,credentials=/etc/auto.smb.laptop
//laptop/C /cifs/laptop/C$
Dec  9 23:49:03 dc2 kernel:  CIFS VFS: cifs_mount failed w/return code
= -6
Dec  9 23:49:03 dc2 automount[19084]: >> retrying with upper case
share name
Dec  9 23:49:03 dc2 kernel:  CIFS VFS: cifs_mount failed w/return code
= -6
Dec  9 23:49:03 dc2 automount[19084]: >> mount error 6 = No such
device or address
Dec  9 23:49:03 dc2 automount[19084]: >> Refer to the mount.cifs(8)
manual page (e.g.man mount.cifs)
Dec  9 23:49:03 dc2 automount[19084]: spawn_mount: mount failed with
error code 16, retrying with the -f option
Dec  9 23:49:06 dc2 automount[19084]: >> unknown mount option f
Dec  9 23:49:06 dc2 automount[19084]: >> Usage:  /sbin/mount.cifs
<remotetarget> <dir> -o <options>
Dec  9 23:49:06 dc2 automount[19084]: >> Mount the remote target,
specified as a UNC name, to a local directory.
Dec  9 23:49:06 dc2 automount[19084]: >> Options:
Dec  9 23:49:06 dc2 automount[19084]: >> #011user=<arg>
Dec  9 23:49:06 dc2 automount[19084]: >> #011pass=<arg>
Dec  9 23:49:06 dc2 automount[19084]: >> #011dom=<arg>
Dec  9 23:49:06 dc2 automount[19084]: >> Less commonly used options:
Dec  9 23:49:06 dc2 automount[19084]: >>
#011credentials=<filename>,guest,perm,noperm,setuids,nosetuids,rw,ro,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011sep=<char>,iocharset=<codepage>,suid,nosuid,exec,noexec,serverino,
Dec  9 23:49:06 dc2 automount[19084]: >>

#011directio,mapchars,nomapchars,nolock,servernetbiosname=<SRV_RFC1001NAME>

Dec  9 23:49:06 dc2 automount[19084]: >> Options not needed for
servers supporting CIFS Unix extensions
Dec  9 23:49:06 dc2 automount[19084]: >> #011(e.g. unneeded for mounts
to most Samba versions):
Dec  9 23:49:06 dc2 automount[19084]: >>
#011uid=<uid>,gid=<gid>,dir_mode=<mode>,file_mode=<mode>,sfu
Dec  9 23:49:06 dc2 automount[19084]: >> Rarely used options:
Dec  9 23:49:06 dc2 automount[19084]: >>

#011port=<tcpport>,rsize=<size>,wsize=<size>,unc=<unc_name>,ip=<ip_address>,

Dec  9 23:49:06 dc2 automount[19084]: >>
#011dev,nodev,nouser_xattr,netbiosname=<OUR_RFC1001NAME>,hard,soft,intr,
Dec  9 23:49:06 dc2 automount[19084]: >>
#011nointr,ignorecase,noposixpaths,noacl
Dec  9 23:49:06 dc2 automount[19084]: >> Options are described in more
detail in the manual page
Dec  9 23:49:06 dc2 automount[19084]: >> #011man 8 mount.cifs
Dec  9 23:49:06 dc2 automount[19084]: >> To display the version number
of the mount helper:
Dec  9 23:49:06 dc2 automount[19084]: >> #011/sbin/mount.cifs -V
Dec  9 23:49:06 dc2 automount[19084]: mount(generic): failed to
mount //laptop/C (type cifs) on /cifs/laptop/C$
Dec  9 23:49:06 dc2 automount[19084]: send_fail: token = 122
Dec  9 23:49:06 dc2 automount[19084]: handle_packet: type = 5
Dec  9 23:49:06 dc2 automount[19084]: handle_packet_missing_direct:
token 123, name /cifs/laptop/C$, request pid 17857
Dec  9 23:49:06 dc2 automount[19084]: attempting to mount
entry /cifs/laptop/C$
Dec  9 23:49:06 dc2 automount[19084]: failed to mount /cifs/laptop/C$
Dec  9 23:49:06 dc2 automount[19084]: send_fail: token = 123
Dec  9 23:49:06 dc2 automount[19084]: failed to mount /cifs/laptop/C$
Quoted 5 lines

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

#4 lore raw
Quoted 13 lines · Ian Kent
Quoted 11 lines · Matthew Jurgens

I've had this same problem from time to time and since upgrading to Fedora 10 it has come back:
Fedora 10 - kernel 2.6.27.21-170.2.56.fc10.i686.PAE autofs-5.0.3-41.i386

The correctly mounted manual entry:
//xp0/C$ on /mnt type cifs (rw,mand)

The autofs entry:
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)

Quoted 7 lines
Quoted 2 lines

If you need anymore debug info let me know

I have no idea what you are trying to say.
The above, //xp0/C/$, doesn't correspond to what autofs-5.0.3-41 passes to mount(8) and I have no idea what has happened since you haven't provided any log information

Sorry, here is more information:

Windows machine called xp0.
cd /smb/xp0/C$ yields the following debug:

May 13 14:43:28 gw automount[15573]: handle_packet: type = 3
May 13 14:43:28 gw automount[15573]: handle_packet_missing_indirect: token 57, name xp0, request pid 15215
May 13 14:43:28 gw automount[15573]: attempting to mount entry /smb/xp0
May 13 14:43:28 gw automount[15573]: lookup_mount: lookup(program): looking up xp0
May 13 14:43:28 gw automount[15573]: lookup_mount: lookup(program): xp0 -> -fstype=cifs,username=USERNAME,password=PASSWORD  #011 /C "://xp0/C"  #011 /ADMIN\$ "://xp0/ADMIN\$"  #011 /C\$ "://xp0/C\$"
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): expanded entry: -fstype=cifs,username=USERNAME,password=PASSWORD  #011 /C "://xp0/C"  #011 /ADMIN\$ "://xp0/ADMIN\$"  #011 /C\$ "://xp0/C\$"
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): gathered options: fstype=cifs,username=USERNAME,password=PASSWORD
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): dequote("/C") -> /C
May 13 14:43:28 gw automount[15573]: parse_mapent: parse(sun): gathered options: fstype=cifs,username=USERNAME,password=PASSWORD
May 13 14:43:28 gw automount[15573]: parse_mapent: parse(sun): dequote(""://xp0/C"") -> ://xp0/C
May 13 14:43:28 gw automount[15573]: add_offset_entry: parse(sun): added multi-mount offset /C -> -fstype=cifs,username=USERNAME,password=PASSWORD ://xp0/C
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): dequote("/ADMIN\$") -> /ADMIN$
May 13 14:43:28 gw automount[15573]: parse_mapent: parse(sun): gathered options: fstype=cifs,username=USERNAME,password=PASSWORD
May 13 14:43:28 gw automount[15573]: parse_mapent: parse(sun): dequote(""://xp0/ADMIN\$"") -> ://xp0/ADMIN\$
May 13 14:43:28 gw automount[15573]: add_offset_entry: parse(sun): added multi-mount offset /ADMIN$ -> -fstype=cifs,username=USERNAME,password=PASSWORD ://xp0/ADMIN\$
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): dequote("/C\$") -> /C$
May 13 14:43:28 gw automount[15573]: parse_mapent: parse(sun): gathered options: fstype=cifs,username=USERNAME,password=PASSWORD
May 13 14:43:28 gw automount[15573]: parse_mapent: parse(sun): dequote(""://xp0/C\$"") -> ://xp0/C\$
May 13 14:43:28 gw automount[15573]: add_offset_entry: parse(sun): added multi-mount offset /C$ -> -fstype=cifs,username=USERNAME,password=PASSWORD ://xp0/C\$
May 13 14:43:28 gw automount[15573]: mount_multi_triggers: mount offset /smb/xp0/ADMIN$ at /smb/xp0
May 13 14:43:28 gw automount[15573]: mount_autofs_offset: calling mount -t autofs -s  -o fd=18,pgrp=15573,minproto=5,maxproto=5,offset automount /smb/xp0/ADMIN$
May 13 14:43:28 gw automount[15573]: mount_autofs_offset: mounted trigger /smb/xp0/ADMIN$ at /smb/xp0/ADMIN$
May 13 14:43:28 gw automount[15573]: mount_multi_triggers: mount offset /smb/xp0/C at /smb/xp0
May 13 14:43:28 gw automount[15573]: mount_autofs_offset: calling mount -t autofs -s  -o fd=18,pgrp=15573,minproto=5,maxproto=5,offset automount /smb/xp0/C
May 13 14:43:28 gw automount[15573]: mount_autofs_offset: mounted trigger /smb/xp0/C at /smb/xp0/C
May 13 14:43:28 gw automount[15573]: mount_multi_triggers: mount offset /smb/xp0/C$ at /smb/xp0
May 13 14:43:28 gw automount[15573]: mount_autofs_offset: calling mount -t autofs -s  -o fd=18,pgrp=15573,minproto=5,maxproto=5,offset automount /smb/xp0/C$
May 13 14:43:28 gw automount[15573]: mount_autofs_offset: mounted trigger /smb/xp0/C$ at /smb/xp0/C$
May 13 14:43:28 gw automount[15573]: send_ready: token = 57
May 13 14:43:28 gw automount[15573]: mounted /smb/xp0
May 13 14:43:28 gw automount[15573]: handle_packet: type = 5
May 13 14:43:28 gw automount[15573]: handle_packet_missing_direct: token 58, name /smb/xp0/C$, request pid 15215
May 13 14:43:28 gw automount[15573]: attempting to mount entry /smb/xp0/C$
May 13 14:43:28 gw automount[15573]: lookup_mount: lookup(program): /smb/xp0/C$ -> -fstype=cifs,username=USERNAME,password=PASSWORD ://xp0/C\$
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): expanded entry: -fstype=cifs,username=USERNAME,password=PASSWORD ://xp0/C\$
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): gathered options: fstype=cifs,username=USERNAME,password=PASSWORD
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): core of entry: options=fstype=cifs,username=USERNAME,password=PASSWORD, loc=://xp0/C\$
May 13 14:43:28 gw automount[15573]: sun_mount: parse(sun): mounting root /tmp/auto6t8L4W, mountpoint /smb/xp0/C$, what //xp0/C\$, fstype cifs, options username=USERNAME,password=PASSWORD
May 13 14:43:28 gw automount[15573]: do_mount: //xp0/C\$ /tmp/auto6t8L4W//smb/xp0/C$ type cifs options username=USERNAME,password=PASSWORD using module generic
May 13 14:43:28 gw automount[15573]: mount_mount: mount(generic): calling mkdir_path /tmp/auto6t8L4W
May 13 14:43:28 gw automount[15573]: mount_mount: mount(generic): calling mount -t cifs -s -o username=USERNAME,password=PASSWORD //xp0/C\$ /tmp/auto6t8L4W
May 13 14:43:28 gw automount[15573]: mount(generic): mounted //xp0/C\$ type cifs on /tmp/auto6t8L4W
May 13 14:43:28 gw automount[15573]: move_mount: moved mount tree from /tmp/auto6t8L4W to /smb/xp0/C$
May 13 14:43:28 gw automount[15573]: send_ready: token = 58
May 13 14:43:28 gw automount[15573]: mounted /smb/xp0/C$

The output of a mount command is:
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)

The incorrect target of //xp0/C/$ does not appear to be reflected in the debug output

The correct output of the mount command should be:
//xp0/C$ on /smb/xp0/C$ type cifs (rw,mand)

-------------------------------------------------------------------------------------------------------------------
http://www.smartmon.com.au

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

maintainer
#5 lore raw
Quoted 121 lines · Matthew Jurgens
Quoted 13 lines · Ian Kent
Quoted 11 lines · Matthew Jurgens

I've had this same problem from time to time and since upgrading to Fedora 10 it has come back:
Fedora 10 - kernel 2.6.27.21-170.2.56.fc10.i686.PAE autofs-5.0.3-41.i386

The correctly mounted manual entry:
//xp0/C$ on /mnt type cifs (rw,mand)

The autofs entry:
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)

Quoted 7 lines
Quoted 2 lines

If you need anymore debug info let me know

I have no idea what you are trying to say.
The above, //xp0/C/$, doesn't correspond to what autofs-5.0.3-41 passes to mount(8) and I have no idea what has happened since you haven't provided any log information

Sorry, here is more information:

Windows machine called xp0.
cd /smb/xp0/C$ yields the following debug:

May 13 14:43:28 gw automount[15573]: handle_packet: type = 3
May 13 14:43:28 gw automount[15573]: handle_packet_missing_indirect:
token 57, name xp0, request pid 15215
May 13 14:43:28 gw automount[15573]: attempting to mount entry /smb/xp0
May 13 14:43:28 gw automount[15573]: lookup_mount: lookup(program):
looking up xp0
May 13 14:43:28 gw automount[15573]: lookup_mount: lookup(program): xp0
-> -fstype=cifs,username=USERNAME,password=PASSWORD  #011 /C "://xp0/C" 
#011 /ADMIN\$ "://xp0/ADMIN\$"  #011 /C\$ "://xp0/C\$"
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): expanded
entry: -fstype=cifs,username=USERNAME,password=PASSWORD  #011 /C
"://xp0/C"  #011 /ADMIN\$ "://xp0/ADMIN\$"  #011 /C\$ "://xp0/C\$"
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): gathered
options: fstype=cifs,username=USERNAME,password=PASSWORD
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun):
dequote("/C") -> /C
May 13 14:43:28 gw automount[15573]: parse_mapent: parse(sun): gathered
options: fstype=cifs,username=USERNAME,password=PASSWORD
May 13 14:43:28 gw automount[15573]: parse_mapent: parse(sun):
dequote(""://xp0/C"") -> ://xp0/C
May 13 14:43:28 gw automount[15573]: add_offset_entry: parse(sun): added
multi-mount offset /C ->
-fstype=cifs,username=USERNAME,password=PASSWORD ://xp0/C
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun):
dequote("/ADMIN\$") -> /ADMIN$
May 13 14:43:28 gw automount[15573]: parse_mapent: parse(sun): gathered
options: fstype=cifs,username=USERNAME,password=PASSWORD
May 13 14:43:28 gw automount[15573]: parse_mapent: parse(sun):
dequote(""://xp0/ADMIN\$"") -> ://xp0/ADMIN\$
May 13 14:43:28 gw automount[15573]: add_offset_entry: parse(sun): added
multi-mount offset /ADMIN$ ->
-fstype=cifs,username=USERNAME,password=PASSWORD ://xp0/ADMIN\$
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun):
dequote("/C\$") -> /C$
May 13 14:43:28 gw automount[15573]: parse_mapent: parse(sun): gathered
options: fstype=cifs,username=USERNAME,password=PASSWORD
May 13 14:43:28 gw automount[15573]: parse_mapent: parse(sun):
dequote(""://xp0/C\$"") -> ://xp0/C\$
May 13 14:43:28 gw automount[15573]: add_offset_entry: parse(sun): added
multi-mount offset /C$ ->
-fstype=cifs,username=USERNAME,password=PASSWORD ://xp0/C\$
May 13 14:43:28 gw automount[15573]: mount_multi_triggers: mount offset
/smb/xp0/ADMIN$ at /smb/xp0
May 13 14:43:28 gw automount[15573]: mount_autofs_offset: calling mount
-t autofs -s  -o fd=18,pgrp=15573,minproto=5,maxproto=5,offset automount
/smb/xp0/ADMIN$
May 13 14:43:28 gw automount[15573]: mount_autofs_offset: mounted
trigger /smb/xp0/ADMIN$ at /smb/xp0/ADMIN$
May 13 14:43:28 gw automount[15573]: mount_multi_triggers: mount offset
/smb/xp0/C at /smb/xp0
May 13 14:43:28 gw automount[15573]: mount_autofs_offset: calling mount
-t autofs -s  -o fd=18,pgrp=15573,minproto=5,maxproto=5,offset automount
/smb/xp0/C
May 13 14:43:28 gw automount[15573]: mount_autofs_offset: mounted
trigger /smb/xp0/C at /smb/xp0/C
May 13 14:43:28 gw automount[15573]: mount_multi_triggers: mount offset
/smb/xp0/C$ at /smb/xp0
May 13 14:43:28 gw automount[15573]: mount_autofs_offset: calling mount
-t autofs -s  -o fd=18,pgrp=15573,minproto=5,maxproto=5,offset automount
/smb/xp0/C$
May 13 14:43:28 gw automount[15573]: mount_autofs_offset: mounted
trigger /smb/xp0/C$ at /smb/xp0/C$
May 13 14:43:28 gw automount[15573]: send_ready: token = 57
May 13 14:43:28 gw automount[15573]: mounted /smb/xp0
May 13 14:43:28 gw automount[15573]: handle_packet: type = 5
May 13 14:43:28 gw automount[15573]: handle_packet_missing_direct: token
58, name /smb/xp0/C$, request pid 15215
May 13 14:43:28 gw automount[15573]: attempting to mount entry /smb/xp0/C$
May 13 14:43:28 gw automount[15573]: lookup_mount: lookup(program):
/smb/xp0/C$ -> -fstype=cifs,username=USERNAME,password=PASSWORD ://xp0/C\$
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): expanded
entry: -fstype=cifs,username=USERNAME,password=PASSWORD ://xp0/C\$
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): gathered
options: fstype=cifs,username=USERNAME,password=PASSWORD
May 13 14:43:28 gw automount[15573]: parse_mount: parse(sun): core of
entry: options=fstype=cifs,username=USERNAME,password=PASSWORD,
loc=://xp0/C\$
May 13 14:43:28 gw automount[15573]: sun_mount: parse(sun): mounting
root /tmp/auto6t8L4W, mountpoint /smb/xp0/C$, what //xp0/C\$, fstype
cifs, options username=USERNAME,password=PASSWORD
May 13 14:43:28 gw automount[15573]: do_mount: //xp0/C\$
/tmp/auto6t8L4W//smb/xp0/C$ type cifs options
username=USERNAME,password=PASSWORD using module generic
May 13 14:43:28 gw automount[15573]: mount_mount: mount(generic):
calling mkdir_path /tmp/auto6t8L4W
May 13 14:43:28 gw automount[15573]: mount_mount: mount(generic):
calling mount -t cifs -s -o username=USERNAME,password=PASSWORD
//xp0/C\$ /tmp/auto6t8L4W
May 13 14:43:28 gw automount[15573]: mount(generic): mounted //xp0/C\$
type cifs on /tmp/auto6t8L4W
May 13 14:43:28 gw automount[15573]: move_mount: moved mount tree from
/tmp/auto6t8L4W to /smb/xp0/C$
May 13 14:43:28 gw automount[15573]: send_ready: token = 58
May 13 14:43:28 gw automount[15573]: mounted /smb/xp0/C$
Quoted 8 lines

The output of a mount command is:
//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)

The incorrect target of //xp0/C/$ does not appear to be reflected in the debug output

The correct output of the mount command should be:
//xp0/C$ on /smb/xp0/C$ type cifs (rw,mand)

Clearly it isn't an autofs problem.
It's a mount.cifs (or mount(8)) problem.

Ian

maintainer
#6 lore raw
Quoted 3 lines · Ian Kent
Quoted 3 lines
May 13 14:43:28 gw automount[15573]: mount_mount: mount(generic):

calling mount -t cifs -s -o username=USERNAME,password=PASSWORD //xp0/C\$ /tmp/auto6t8L4W

Ohh, I get it, the "\" is a path separator for mount.cifs and I think the handling of it may have changed recently ish.

So catch 22, autofs must escaped the "$" to prevent it being interpreted as a macro and the generic mount module has no special knowledge of cifs so it can't do anything about it. Worse, since "\" is a valid path separator for UNC paths we can't just check the fs type and translate them all. For example, what if we get :\\\\<server>\\service as the location?

Ian

#7 lore raw
Quoted 7 lines · On Wed, 13 May 2009 13:30:50 +0800 Ian Kent <[email protected]> wrote:
Quoted 3 lines · Ian Kent
Quoted 3 lines
May 13 14:43:28 gw automount[15573]: mount_mount: mount(generic):

calling mount -t cifs -s -o username=USERNAME,password=PASSWORD //xp0/C\$ /tmp/auto6t8L4W

Ohh, I get it, the "\" is a path separator for mount.cifs and I think the handling of it may have changed recently ish.

Around a year ago, yes.

Quoted 8 lines

So catch 22, autofs must escaped the "$" to prevent it being interpreted as a macro and the generic mount module has no special knowledge of cifs so it can't do anything about it. Worse, since "\" is a valid path separator for UNC paths we can't just check the fs type and translate them all. For example, what if we get :\\\\<server>\\service as the location?

Right -- and it's even worse than that. '\' is a valid character in posix path components. It's perfectly legitimate (though insane) to have a file named:

/home/jlayton/crazy\file

'crazy\file' is a valid file/dir name.

I did a small writeup on this for the mount.cifs(8) manpage -- see the section called 'SERVICE FORMATTING AND DELIMITERS'.

I think the only real way to solve this is to make sure that autofs doesn't try to escape these characters before it calls mount. I don't think mount does any variable interpolation, and I know mount.cifs doesn't so there shouldn't be any need for escape chars before '$' signs, assuming you're not handing these off to a shell of some sort.

Signature · 1 line
Jeff Layton <[email protected]>
maintainer
#8 lore raw
Quoted 7 lines · Jeff Layton

I think the only real way to solve this is to make sure that autofs doesn't try to escape these characters before it calls mount. I don't think mount does any variable interpolation, and I know mount.cifs doesn't so there shouldn't be any need for escape chars before '$' signs, assuming you're not handing these off to a shell of some sort.

Yes, I'm thinking I shouldn't be double escaping the $ as using quotes around these should prevent the $ being interpreted as a macro introducer.

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#10 lore raw
Quoted 13 lines · Matthew Jurgens

The output of a mount command is:

Quoted 12 lines
Quoted 8 lines

//xp0/C/$ on /smb/xp0/C$ type cifs (rw,mand)

The incorrect target of //xp0/C/$ does not appear to be reflected in the debug output

The correct output of the mount command should be:
//xp0/C$ on /smb/xp0/C$ type cifs (rw,mand)

Clearly it isn't an autofs problem.
It's a mount.cifs (or mount(8)) problem.

Quoted 7 lines
Quoted 2 lines

Ian

I'm not quite sure how it is a mount.cifs problem since I can manually mount the share.
If I can manually mount it since I pass a correct mount target, couldn't autofs do the same?
Am I missing something?

Yes, when you mount it manually you don't escape the "$".

#11 lore raw
Quoted 2 lines

Yes, when you mount it manually you don't escape the "$"

If I manually mount it using:
mount -t cifs -o username=mjurgens,password=parallel12 //xp0/C$ /mnt/C$ it works. If I also escape the $ then it also works
mount -t cifs -o username=mjurgens,password=parallel12 //xp0/C\$ /mnt/C\$

Was that what you were talking about?

#12 lore raw

Yes, when you mount it manually you don't escape the "$"

Quoted 5 lines

If I manually mount it using:
mount -t cifs -o username=mjurgens,password=parallel12 //xp0/C$ /mnt/C$ it works. If I also escape the $ then it also works
mount -t cifs -o username=mjurgens,password=parallel12 //xp0/C\$ /mnt/C\$

Quoted 7 lines

Was that what you were talking about?

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

When I was on Fedora 8 and autofs-5.0.2-16 <http://koji.fedoraproject.org/koji/buildinfo?buildID=46891> <http://koji.fedoraproject.org/koji/buildinfo?buildID=46891> it worked Then when I upgraded only autofs to 5.0.3 it was broken
Doesn't that suggest that it is something in the autofs code that can therefore be potentially fixed?

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

maintainer
#13 lore raw
Quoted 14 lines · Matthew Jurgens

Yes, when you mount it manually you don't escape the "$"

Quoted 5 lines

If I manually mount it using:
mount -t cifs -o username=mjurgens,password=parallel12 //xp0/C$ /mnt/C$ it works. If I also escape the $ then it also works
mount -t cifs -o username=mjurgens,password=parallel12 //xp0/C\$ /mnt/C\$

Quoted 7 lines

Was that what you were talking about?

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

Quoted 7 lines

When I was on Fedora 8 and autofs-5.0.2-16
<http://koji.fedoraproject.org/koji/buildinfo?buildID=46891>
<http://koji.fedoraproject.org/koji/buildinfo?buildID=46891> it worked Then when I upgraded only autofs to 5.0.3 it was broken Doesn't that suggest that it is something in the autofs code that can therefore be potentially fixed?

Maybe.

There is always the possibility of working around things like this. But it may not be a simple matter to change this as lot of change has taken place.

maintainer
#14 lore raw
Quoted 23 lines · Ian Kent
Quoted 14 lines · Matthew Jurgens

Yes, when you mount it manually you don't escape the "$"

Quoted 5 lines

If I manually mount it using:
mount -t cifs -o username=mjurgens,password=parallel12 //xp0/C$ /mnt/C$ it works. If I also escape the $ then it also works
mount -t cifs -o username=mjurgens,password=parallel12 //xp0/C\$ /mnt/C\$

Quoted 7 lines

Was that what you were talking about?

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

Quoted 7 lines

When I was on Fedora 8 and autofs-5.0.2-16
<http://koji.fedoraproject.org/koji/buildinfo?buildID=46891>
<http://koji.fedoraproject.org/koji/buildinfo?buildID=46891> it worked Then when I upgraded only autofs to 5.0.3 it was broken Doesn't that suggest that it is something in the autofs code that can therefore be potentially fixed?

Quoted 5 lines

Maybe.

There is always the possibility of working around things like this. But it may not be a simple matter to change this as lot of change has taken place.

Maybe we should try a couple of things and see what we get. I don't have a Windows environment I can use here so you will have to help.

I'm wondering why I need to double escape the $ after looking at your debug log.

How about commenting out the line "gsub(/\$$/, "\\$", loc);" in /etc/auto.smb and see what happens.

Ian

maintainer
#15 lore raw
In reply to Matthew Jurgens
Quoted 8 lines · Matthew Jurgens
Quoted 2 lines

Yes, when you mount it manually you don't escape the "$"

If I manually mount it using:
mount -t cifs -o username=mjurgens,password=parallel12 //xp0/C$ /mnt/C$ it works. If I also escape the $ then it also works
mount -t cifs -o username=mjurgens,password=parallel12 //xp0/C\$ /mnt/C\$

Was that what you were talking about?

So maybe I'm wrong and were back to were we started. Unless the shell translates the escape!

I bet that:

mount -t cifs -o username=mjurgens,password=parallel12 \
	'//xp0/C\$' /mnt/C\$

fails.

#16 lore raw
Quoted 7 lines

I bet that:

mount -t cifs -o username=USER,password=PASS \
	'//xp0/C\$' /mnt/C\$

fails.

Good bet.
It certainly does fail. The output of mount for that is now:

//xp0/C/$ on /mnt/C$ type cifs (rw,mand)

Reading ahead in the thread Jeff says "'\' is a valid character in posix path components" which does explain this behaviour

Do you really need the \ in front of the $ when it is already quoted?

Reading ahead again I comment out the gsub in /etc/auto.smb which changes the output from

-fstype=cifs,username=USER,password=PASS \
         /C "://xp0/C" \
         /ADMIN\$ "://xp0/ADMIN\$" \
         /C\$ "://xp0/C\$"

to

-fstype=cifs,username=USER,password=PASS \
         /C "://xp0/C" \
         /ADMIN$ "://xp0/ADMIN$" \
         /C$ "://xp0/C$"

So the
/C$ "://xp0/C$"
does look at little friendlier but does not actually work (does some autofs code need to change as well?).

When I
cd /smb/xp0/C$
I get
cd: no such file or directory: /smb/xp0/C$

I get the same result even trying to
cd /smb/xp0

The debug output from this is:

May 14 09:49:52 gw automount[9171]: handle_packet: type = 3
May 14 09:49:52 gw automount[9171]: handle_packet_missing_indirect: 
token 71, name xp0, request pid 15215
May 14 09:49:52 gw automount[9171]: attempting to mount entry /smb/xp0
May 14 09:49:52 gw automount[9171]: lookup_mount: lookup(program): 
looking up xp0
May 14 09:49:52 gw automount[9171]: lookup_mount: lookup(program): xp0 
-> -fstype=cifs,username=USER,password=PASS  #011 /C "://xp0/C"  #011 
/ADMIN$ "://xp0/ADMIN$"  #011 /C$ "://xp0/C$"
May 14 09:49:52 gw automount[9171]: parse_mount: parse(sun): expanded 
entry: -fstype=cifs,username=USER,password=PASS  #011 /C "://xp0/C"  
#011 /ADMIN "://xp0/ADMIN$"  #011 /C "://xp0/C$"
May 14 09:49:52 gw automount[9171]: parse_mount: parse(sun): gathered 
options: fstype=cifs,username=USER,password=PASS
May 14 09:49:52 gw automount[9171]: parse_mount: parse(sun): 
dequote("/C") -> /C
May 14 09:49:52 gw automount[9171]: parse_mapent: parse(sun): gathered 
options: fstype=cifs,username=USER,password=PASS
May 14 09:49:52 gw automount[9171]: parse_mapent: parse(sun): 
dequote(""://xp0/C"") -> ://xp0/C
May 14 09:49:52 gw automount[9171]: add_offset_entry: parse(sun): added 
multi-mount offset /C -> -fstype=cifs,username=USER,password=PASS ://xp0/C
May 14 09:49:52 gw automount[9171]: parse_mount: parse(sun): 
dequote("/ADMIN") -> /ADMIN
May 14 09:49:52 gw automount[9171]: parse_mapent: parse(sun): gathered 
options: fstype=cifs,username=USER,password=PASS
May 14 09:49:52 gw automount[9171]: parse_mapent: parse(sun): 
dequote(""://xp0/ADMIN$"") -> ://xp0/ADMIN$
May 14 09:49:52 gw automount[9171]: add_offset_entry: parse(sun): added 
multi-mount offset /ADMIN -> -fstype=cifs,username=USER,password=PASS 
://xp0/ADMIN$
May 14 09:49:52 gw automount[9171]: parse_mount: parse(sun): 
dequote("/C") -> /C
May 14 09:49:52 gw automount[9171]: parse_mapent: parse(sun): gathered 
options: fstype=cifs,username=USER,password=PASS
May 14 09:49:52 gw automount[9171]: parse_mapent: parse(sun): 
dequote(""://xp0/C$"") -> ://xp0/C$
May 14 09:49:52 gw automount[9171]: parse(sun): syntax error or 
duplicate offset /C -> ://xp0/C$
May 14 09:49:52 gw automount[9171]: parse(sun): error adding multi-mount
May 14 09:49:52 gw automount[9171]: cache_delete_offset_list: deleting 
offset key /smb/xp0/ADMIN
May 14 09:49:52 gw automount[9171]: cache_delete_offset_list: deleting 
offset key /smb/xp0/C
May 14 09:49:52 gw automount[9171]: send_fail: token = 71
May 14 09:49:52 gw automount[9171]: failed to mount /smb/xp0
May 14 09:49:52 gw automount[9171]: handle_packet: type = 3
May 14 09:49:52 gw automount[9171]: handle_packet_missing_indirect: 
token 72, name xp0, request pid 15215
May 14 09:49:52 gw automount[9171]: attempting to mount entry /smb/xp0
May 14 09:49:52 gw automount[9171]: lookup_nss_mount: key "xp0" not 
found in map.
May 14 09:49:52 gw automount[9171]: send_fail: token = 72
May 14 09:49:52 gw automount[9171]: failed to mount /smb/xp0
maintainer
#17 lore raw
Quoted 24 lines · Matthew Jurgens
Quoted 7 lines

I bet that:

mount -t cifs -o username=USER,password=PASS \
    '//xp0/C\$' /mnt/C\$

fails.

Good bet.
It certainly does fail. The output of mount for that is now:

//xp0/C/$ on /mnt/C$ type cifs (rw,mand)

Reading ahead in the thread Jeff says "'\' is a valid character in posix path components" which does explain this behaviour

Do you really need the \ in front of the $ when it is already quoted?

Reading ahead again I comment out the gsub in /etc/auto.smb which changes the output from

-fstype=cifs,username=USER,password=PASS \
        /C "://xp0/C" \
        /ADMIN\$ "://xp0/ADMIN\$" \
        /C\$ "://xp0/C\$"
Quoted 6 lines

to

-fstype=cifs,username=USER,password=PASS \
        /C "://xp0/C" \
        /ADMIN$ "://xp0/ADMIN$" \
        /C$ "://xp0/C$"

Of course, it then doesn't escape $ in the offsets. But, it looks like your script isn't up to date. I'm fairly sure the current script should output:

 -fstype=cifs,username=USER,password=PASS \
         "/C" "://xp0/C" \
         "/ADMIN$" "://xp0/ADMIN$" \
         "/C$" "://xp0/C$"

which is why I thought we shouldn't need the "\" escapes. Can you check your auto.smb against the one attached please, in particular the last line at the bottom of the "/Disk/" block should be:

print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""

Ian

#!/bin/bash

# $Id: auto.smb,v 1.3 2005/04/05 13:02:09 raven Exp $

# 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 }
	'

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#19 lore raw
Quoted 24 lines · Matthew Jurgens
Quoted 9 lines

Of course, it then doesn't escape $ in the offsets. But, it looks like your script isn't up to date. I'm fairly sure the current script should output:

 -fstype=cifs,username=USER,password=PASS \
         "/C" "://xp0/C" \
         "/ADMIN$" "://xp0/ADMIN$" \
         "/C$" "://xp0/C$"
Quoted 8 lines

which is why I thought we shouldn't need the "\" escapes. Can you check your auto.smb against the one attached please, in particular the last line at the bottom of the "/Disk/" block should be:

print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""

Ian

Script updated and gsub commented out (like a message earlier in the thread):

-fstype=cifs,username=USER,password=PASS \
        "/C" "://xp0/C" \
        "/ADMIN$" "://xp0/ADMIN$" \
        "/C$" "://xp0/C$"
Quoted 7 lines

cd /smb/xp0/C$ gives
cd: no such file or directory: /smb/xp0/C$

something is really busted now since I can't even cd /smb/xp0/C either. I don't understand why the debug log contains what looks like parts of the script as the output since running the script manually seems to have perfectly clean output

Because the script file is not executable now it is treating it as a file map not a program map.

Quoted 95 lines

debug output is:

May 15 11:09:01 gw automount[20964]: st_expire: state 1 path /smb
May 15 11:09:01 gw automount[20964]: expire_proc: exp_proc = 3082091408
path /smb
May 15 11:09:01 gw automount[20964]: expire_cleanup: got thid 3082091408
path /smb stat 0
May 15 11:09:01 gw automount[20964]: expire_cleanup: sigchld: exp
3082091408 finished, switching from 2 to 1
May 15 11:09:01 gw automount[20964]: st_ready: st_ready(): state = 2
path /smb
May 15 11:09:01 gw automount[20964]: handle_packet: type = 3
May 15 11:09:01 gw automount[20964]: handle_packet_missing_indirect:
token 101, name xp0, request pid 17443
May 15 11:09:01 gw automount[20964]: attempting to mount entry /smb/xp0
May 15 11:09:01 gw automount[20964]: lookup_mount: lookup(file): looking
up xp0
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "[ -x
$P/smbclient ]..." for key "if"
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "-A
$smbauthfile -gL $key 2>/dev/null| awk -v key="$key" -v opts="$opts"
-F'|' -- '..." for key "$SMBCLIENT"
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "[ -x
$P/smbclient ]..." for key "if"
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "-A
$smbauthfile -gL $key 2>/dev/null| awk -v key="$key" -v opts="$opts"
-F'|' -- '..." for key "$SMBCLIENT"
May 15 11:09:01 gw automount[20964]: lookup_nss_mount: key "xp0" not
found in map.
May 15 11:09:01 gw automount[20964]: send_fail: token = 101
May 15 11:09:01 gw automount[20964]: failed to mount /smb/xp0
May 15 11:09:01 gw automount[20964]: handle_packet: type = 3
May 15 11:09:01 gw automount[20964]: handle_packet_missing_indirect:
token 102, name xp0, request pid 17443
May 15 11:09:01 gw automount[20964]: attempting to mount entry /smb/xp0
May 15 11:09:01 gw automount[20964]: lookup_mount: lookup(file): looking
up xp0
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "[ -x
$P/smbclient ]..." for key "if"
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "-A
$smbauthfile -gL $key 2>/dev/null| awk -v key="$key" -v opts="$opts"
-F'|' -- '..." for key "$SMBCLIENT"
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "[ -x
$P/smbclient ]..." for key "if"
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "-A
$smbauthfile -gL $key 2>/dev/null| awk -v key="$key" -v opts="$opts"
-F'|' -- '..." for key "$SMBCLIENT"
May 15 11:09:01 gw automount[20964]: lookup_nss_mount: key "xp0" not
found in map.
May 15 11:09:01 gw automount[20964]: send_fail: token = 102
May 15 11:09:01 gw automount[20964]: failed to mount /smb/xp0
May 15 11:09:01 gw automount[20964]: handle_packet: type = 3
May 15 11:09:01 gw automount[20964]: handle_packet_missing_indirect:
token 103, name xp0, request pid 17443
May 15 11:09:01 gw automount[20964]: attempting to mount entry /smb/xp0
May 15 11:09:01 gw automount[20964]: lookup_mount: lookup(file): looking
up xp0
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "[ -x
$P/smbclient ]..." for key "if"
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "-A
$smbauthfile -gL $key 2>/dev/null| awk -v key="$key" -v opts="$opts"
-F'|' -- '..." for key "$SMBCLIENT"
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "[ -x
$P/smbclient ]..." for key "if"
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "-A
$smbauthfile -gL $key 2>/dev/null| awk -v key="$key" -v opts="$opts"
-F'|' -- '..." for key "$SMBCLIENT"
May 15 11:09:01 gw automount[20964]: lookup_nss_mount: key "xp0" not
found in map.
May 15 11:09:01 gw automount[20964]: send_fail: token = 103
May 15 11:09:01 gw automount[20964]: failed to mount /smb/xp0
May 15 11:09:01 gw automount[20964]: handle_packet: type = 3
May 15 11:09:01 gw automount[20964]: handle_packet_missing_indirect:
token 104, name xp0, request pid 17443
May 15 11:09:01 gw automount[20964]: attempting to mount entry /smb/xp0
May 15 11:09:01 gw automount[20964]: lookup_mount: lookup(file): looking
up xp0
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "[ -x
$P/smbclient ]..." for key "if"
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "-A
$smbauthfile -gL $key 2>/dev/null| awk -v key="$key" -v opts="$opts"
-F'|' -- '..." for key "$SMBCLIENT"
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "[ -x
$P/smbclient ]..." for key "if"
May 15 11:09:01 gw automount[20964]: lookup(file): bad map entry "-A
$smbauthfile -gL $key 2>/dev/null| awk -v key="$key" -v opts="$opts"
-F'|' -- '..." for key "$SMBCLIENT"
May 15 11:09:01 gw automount[20964]: lookup_nss_mount: key "xp0" not
found in map.
May 15 11:09:01 gw automount[20964]: send_fail: token = 104
May 15 11:09:01 gw automount[20964]: failed to mount /smb/xp0
#20 lore raw
Quoted 11 lines
Quoted 11 lines

Script updated and gsub commented out (like a message earlier in the thread):

-fstype=cifs,username=USER,password=PASS \
        "/C" "://xp0/C" \
        "/ADMIN$" "://xp0/ADMIN$" \
        "/C$" "://xp0/C$"

cd /smb/xp0/C$ gives
cd: no such file or directory: /smb/xp0/C$

Quoted 8 lines
Quoted 5 lines

something is really busted now since I can't even cd /smb/xp0/C either. I don't understand why the debug log contains what looks like parts of the script as the output since running the script manually seems to have perfectly clean output

Because the script file is not executable now it is treating it as a file map not a program map.

Not sure how you come to that conclusion since I ran it above to get the output and it is -rwxr-xr-x

Signature · 2 lines
Smartmon System Monitoring <http://www.smartmon.com.au>
www.smartmon.com.au

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

maintainer
#21 lore raw
Quoted 17 lines · Matthew Jurgens
Quoted 17 lines
Quoted 16 lines

Script updated and gsub commented out (like a message earlier in the thread):

-fstype=cifs,username=USER,password=PASS \
        "/C" "://xp0/C" \
        "/ADMIN$" "://xp0/ADMIN$" \
        "/C$" "://xp0/C$"

cd /smb/xp0/C$ gives
cd: no such file or directory: /smb/xp0/C$

something is really busted now since I can't even cd /smb/xp0/C either. I don't understand why the debug log contains what looks like parts of the script as the output since running the script manually seems to have perfectly clean output

Quoted 6 lines
Quoted 2 lines

Because the script file is not executable now it is treating it as a file map not a program map.

Not sure how you come to that conclusion since I ran it above to get the output and it is
-rwxr-xr-x

Because of:

May 15 11:09:01 gw automount[20964]: attempting to mount entry /smb/xp0
May 15 11:09:01 gw automount[20964]: lookup_mount: lookup(file): looking

up xp0

and since this is executed during the lookup:

static int lookup_name_file_source_instance(struct autofs_point
*ap, struct map_source *map, const char *name, int name_len)

        struct map_source *instance;
        char src_file[] = "file";
        char src_prog[] = "program";
        time_t age = time(NULL);
        struct stat st;
        char *type, *format;

        if (stat(map->argv[0], &st) == -1) {
                warn(ap->logopt, "file map not found");
                return NSS_STATUS_NOTFOUND;
        }

        if (!S_ISREG(st.st_mode))
                return NSS_STATUS_NOTFOUND;

        if (st.st_mode & __S_IEXEC)
                type = src_prog;
        else
                type = src_file;

        format = map->format;

....

#22 lore raw
Quoted 56 lines · Ian Kent
Quoted 16 lines · Matthew Jurgens
Quoted 16 lines
Quoted 16 lines

Script updated and gsub commented out (like a message earlier in the thread):

-fstype=cifs,username=USER,password=PASS \
        "/C" "://xp0/C" \
        "/ADMIN$" "://xp0/ADMIN$" \
        "/C$" "://xp0/C$"

cd /smb/xp0/C$ gives
cd: no such file or directory: /smb/xp0/C$

something is really busted now since I can't even cd /smb/xp0/C either. I don't understand why the debug log contains what looks like parts of the script as the output since running the script manually seems to have perfectly clean output

Quoted 7 lines
Quoted 3 lines

Because the script file is not executable now it is treating it as a file map not a program map.

Not sure how you come to that conclusion since I ran it above to get the output and it is
-rwxr-xr-x

Because of:

May 15 11:09:01 gw automount[20964]: attempting to mount entry /smb/xp0
May 15 11:09:01 gw automount[20964]: lookup_mount: lookup(file): looking

up xp0

and since this is executed during the lookup:

static int lookup_name_file_source_instance(struct autofs_point
*ap, struct map_source *map, const char *name, int name_len)

        struct map_source *instance;
        char src_file[] = "file";
        char src_prog[] = "program";
        time_t age = time(NULL);
        struct stat st;
        char *type, *format;

        if (stat(map->argv[0], &st) == -1) {
                warn(ap->logopt, "file map not found");
                return NSS_STATUS_NOTFOUND;
        }

        if (!S_ISREG(st.st_mode))
                return NSS_STATUS_NOTFOUND;

        if (st.st_mode & __S_IEXEC)
                type = src_prog;
        else
                type = src_file;

        format = map->format;
Quoted 4 lines

....

Sorry I must be missing something.
You say autofs is now treating the script as a file since it is not executable but it is executable. I don't quite understand the "if (st.st_mode & __S_IEXEC)" part of the code above.

Signature · 2 lines
Smartmon System Monitoring <http://www.smartmon.com.au>
www.smartmon.com.au

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

maintainer
#23 lore raw
Quoted 64 lines · Matthew Jurgens
Quoted 58 lines · Ian Kent
Quoted 17 lines · Matthew Jurgens
Quoted 17 lines
Quoted 17 lines

Script updated and gsub commented out (like a message earlier in the thread):

-fstype=cifs,username=USER,password=PASS \
        "/C" "://xp0/C" \
        "/ADMIN$" "://xp0/ADMIN$" \
        "/C$" "://xp0/C$"

cd /smb/xp0/C$ gives
cd: no such file or directory: /smb/xp0/C$

something is really busted now since I can't even cd /smb/xp0/C either.
I don't understand why the debug log contains what looks like parts of the script as the output since running the script manually seems to have
perfectly clean output

Quoted 7 lines
Quoted 3 lines

Because the script file is not executable now it is treating it as a file map not a program map.

Not sure how you come to that conclusion since I ran it above to get the output and it is
-rwxr-xr-x

Because of:

May 15 11:09:01 gw automount[20964]: attempting to mount entry /smb/xp0
May 15 11:09:01 gw automount[20964]: lookup_mount: lookup(file): looking

up xp0

and since this is executed during the lookup:

static int lookup_name_file_source_instance(struct autofs_point
*ap, struct map_source *map, const char *name, int
name_len)

        struct map_source *instance;
        char src_file[] = "file";
        char src_prog[] = "program";
        time_t age = time(NULL);
        struct stat st;
        char *type, *format;

        if (stat(map->argv[0], &st) == -1) {
                warn(ap->logopt, "file map not found");
                return NSS_STATUS_NOTFOUND;
        }

        if (!S_ISREG(st.st_mode))
                return NSS_STATUS_NOTFOUND;

        if (st.st_mode & __S_IEXEC)
                type = src_prog;
        else
                type = src_file;

        format = map->format;
Quoted 4 lines

....

Quoted 5 lines

Sorry I must be missing something.
You say autofs is now treating the script as a file since it is not executable but it is executable.
I don't quite understand the "if (st.st_mode & __S_IEXEC)" part of the code above.

All I'm saying is that, for whatever reason, autofs is treating your program map as a file map. Why I don't know.

The check (st.st_mode & __S_IEXEC) checks if the mode returned by the stat(2) of the path in ap->argv[0] is executable by the owner of the file.

Ian

#24 lore raw
Quoted 8 lines
Quoted 7 lines

Sorry I must be missing something.
You say autofs is now treating the script as a file since it is not executable but it is executable.
I don't quite understand the "if (st.st_mode & __S_IEXEC)" part of the code above.

Quoted 9 lines

All I'm saying is that, for whatever reason, autofs is treating your program map as a file map. Why I don't know.

The check (st.st_mode & __S_IEXEC) checks if the mode returned by the stat(2) of the path in ap->argv[0] is executable by the owner of the file.

Ian

Can you please then just explain what

"if (st.st_mode & __S_IEXEC)" is testing for?

Signature · 2 lines
Smartmon System Monitoring <http://www.smartmon.com.au>
www.smartmon.com.au

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

maintainer
#25 lore raw
Quoted 15 lines · Matthew Jurgens
Quoted 15 lines
Quoted 7 lines

Sorry I must be missing something.
You say autofs is now treating the script as a file since it is not executable but it is executable.
I don't quite understand the "if (st.st_mode & __S_IEXEC)" part of the code above.

All I'm saying is that, for whatever reason, autofs is treating your program map as a file map. Why I don't know.

The check (st.st_mode & __S_IEXEC) checks if the mode returned by the stat(2) of the path in ap->argv[0] is executable by the owner of the file.

Quoted 6 lines
Quoted 3 lines

Ian

Can you please then just explain what

"if (st.st_mode & __S_IEXEC)" is testing for?

Ha, but I did!

It is checking if the map (path in ap->argv[0]) has the execute bit set for the owner.

Ian

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#27 lore raw
Quoted 8 lines · Matthew Jurgens
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

All I'm saying is that, for whatever reason, autofs is treating your program map as a file map. Why I don't know.

It is checking if the map (path in ap->argv[0]) has the execute bit set for the owner.

Quoted 7 lines
Quoted 3 lines

Ian

So my file looks like
-rwxr-xr-x 1 root root 1193 2009-05-16 09:53 /opt/maj/auto.samba
Which seems to meet all the criteria - owned by root, executable by root etc etc

Yes, it looks OK but I don't know of any problems with this, so I'm at a loss as to what could be happening.

Does running this script using "/opt/maj/auto.samba <some server>" work?

Quoted 4 lines

This is only a side issue as to why we can not automount samba paths ending in $

Sure, but we can't check changes to the script if we can't execute it.

Ian

maintainer
#28 lore raw
In reply to a message not in the archive
Quoted 8 lines · Matthew Jurgens
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

All I'm saying is that, for whatever reason, autofs is treating your program map as a file map. Why I don't know.

It is checking if the map (path in ap->argv[0]) has the execute bit set for the owner.

Quoted 7 lines
Quoted 3 lines

Ian

So my file looks like
-rwxr-xr-x 1 root root 1193 2009-05-16 09:53 /opt/maj/auto.samba
Which seems to meet all the criteria - owned by root, executable by root etc etc

What does the master map entry for this look like?
If you have "file:" in front of the map path that will force autofs to treat it as a file map.

Ian

#29 lore raw
Quoted 8 lines

What does the master map entry for this look like?
If you have "file:" in front of the map path that will force autofs to treat it as a file map.

Ian

I found that the auto.master had a file: in front of the /smb entry - then I read this (would have saved me some time!) Now lets stop this part of the thread and I will resume from an earlier point

Signature · 2 lines
Smartmon System Monitoring <http://www.smartmon.com.au>
www.smartmon.com.au

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

#30 lore raw
In reply to Ian Kent
Quoted 34 lines
Quoted 18 lines

Good bet.
It certainly does fail. The output of mount for that is now:

//xp0/C/$ on /mnt/C$ type cifs (rw,mand)

Reading ahead in the thread Jeff says "'\' is a valid character in posix path components" which does explain this behaviour

Do you really need the \ in front of the $ when it is already quoted?

Reading ahead again I comment out the gsub in /etc/auto.smb which changes the output from

-fstype=cifs,username=USER,password=PASS \
        /C "://xp0/C" \
        /ADMIN\$ "://xp0/ADMIN\$" \
        /C\$ "://xp0/C\$"
Quoted 7 lines

to

-fstype=cifs,username=USER,password=PASS \
        /C "://xp0/C" \
        /ADMIN$ "://xp0/ADMIN$" \
        /C$ "://xp0/C$"

Of course, it then doesn't escape $ in the offsets. But, it looks like your script isn't up to date. I'm fairly sure the current script should output:

 -fstype=cifs,username=USER,password=PASS \
         "/C" "://xp0/C" \
         "/ADMIN$" "://xp0/ADMIN$" \
         "/C$" "://xp0/C$"
Quoted 9 lines

which is why I thought we shouldn't need the "\" escapes. Can you check your auto.smb against the one attached please, in particular the last line at the bottom of the "/Disk/" block should be:

print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""

Ian

Ian you are brilliant. You know your product very well. Thank you very much for your help

I now submit my modified version of the auto.smb script. This auto.smb script optionally supports authentication of smb/cifs shares. Only tested under Fedora 10. Based on the original script as distributed, the work in this thread and my own script.

#!/bin/sh
# This file must be executable to work! chmod 755!

# autofs samba script by Matthew Jurgens June 2009
# based on the original script distributed with autofs
# optionally uses authentication for smb/cifs shares
# mounts shares ending in $ successfully (Thanks to Ian Kent)
# optional authentication information
# either set it here or pass it in via the environment
# SMB_USER=
# SMB_PASSWORD

key="$1" # key comes is as something like a hostname eg matthew

if [ "$SMB_USER" ]; then
opts="-fstype=cifs,username=$SMB_USER,password=$SMB_PASSWORD"

  # setup up the authentication file for smbmount
  # Sept 2008
  # Going to Fedora 9 smbmount no longer worked properly with the 
username%password syntax
  # Had to implement the auth file using the -A parameter
  smbauthfile=/tmp/smbauth.tmp
  echo "username=$SMB_USER" > $smbauthfile
  echo "password=$SMB_PASSWORD" >> $smbauthfile
  # set up the optional parameter for smbmount for using authentication
  auth_part="-A $smbauthfile"

else

  # set up default options - no authentication
  opts="-fstype=cifs"
fi

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 $auth_part -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 }
'

rm -f $smbauthfile

Signature · 2 lines
Smartmon System Monitoring <http://www.smartmon.com.au>
www.smartmon.com.au

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

maintainer
#31 lore raw
Quoted 43 lines · Matthew Jurgens
Quoted 34 lines
Quoted 18 lines

Good bet.
It certainly does fail. The output of mount for that is now:

//xp0/C/$ on /mnt/C$ type cifs (rw,mand)

Reading ahead in the thread Jeff says "'\' is a valid character in posix path components" which does explain this behaviour

Do you really need the \ in front of the $ when it is already quoted?

Reading ahead again I comment out the gsub in /etc/auto.smb which changes the output from

-fstype=cifs,username=USER,password=PASS \
        /C "://xp0/C" \
        /ADMIN\$ "://xp0/ADMIN\$" \
        /C\$ "://xp0/C\$"
Quoted 7 lines

to

-fstype=cifs,username=USER,password=PASS \
        /C "://xp0/C" \
        /ADMIN$ "://xp0/ADMIN$" \
        /C$ "://xp0/C$"

Of course, it then doesn't escape $ in the offsets. But, it looks like your script isn't up to date. I'm fairly sure the current script should output:

 -fstype=cifs,username=USER,password=PASS \
         "/C" "://xp0/C" \
         "/ADMIN$" "://xp0/ADMIN$" \
         "/C$" "://xp0/C$"
Quoted 9 lines

which is why I thought we shouldn't need the "\" escapes. Can you check your auto.smb against the one attached please, in particular the last line at the bottom of the "/Disk/" block should be:

print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""

Ian

Quoted 7 lines

Ian you are brilliant. You know your product very well. Thank you very much for your help

I now submit my modified version of the auto.smb script. This auto.smb script optionally supports authentication of smb/cifs shares. Only tested under Fedora 10. Based on the original script as distributed, the work in this thread and my own script.

There are a couple of problems with this.

The first thing is that it isn't a patch, it's just a verbatim script. While this isn't really an issue with this change this is the way it needs to be done.

Patches should be used to request changes and should apply from the top of the distribution tree when a "-p1" option is used with the patch utility and the "-p" option should be used with the diff utility when making them to give better context.

If you have a Fedora or rpm based distribution the gendiff utility, from the rpm-build package is quite useful for this, although I seem to remember needing to add the -p option for the diff to the script.

Also, patches should address one issue, where possible, and have an accompanying description of what issue or enhancement the patch is addressing and why you believe it works and any other pertinent information.

For some time now I've been trying to "always" include descriptions with patches I add to autofs so I think anyone else requesting changes should do the same.

In this example, I think, there are two distinct changes, the addition of a couple of variables and the commenting out of the gsub() call.

But moving along ...

Quoted 8 lines

#!/bin/sh
# This file must be executable to work! chmod 755!

# autofs samba script by Matthew Jurgens June 2009
# based on the original script distributed with autofs
# optionally uses authentication for smb/cifs shares
# mounts shares ending in $ successfully (Thanks to Ian Kent)
Quoted 4 lines
# optional authentication information
# either set it here or pass it in via the environment
# SMB_USER=
# SMB_PASSWORD

I don't think that embedding password information in a distributed example program map is the right thing to do. People need to work out how they will access authentication information for themselves and modify the example program map to suite.

Also, I don't understand how this can be set in the environment. If it is set in the daemon environment, typically root, and used for every mount then I don't think that is a good example of usage to distribute either.

Quoted 34 lines

key="$1" # key comes is as something like a hostname eg matthew

if [ "$SMB_USER" ]; then
opts="-fstype=cifs,username=$SMB_USER,password=$SMB_PASSWORD"

  # setup up the authentication file for smbmount
  # Sept 2008
  # Going to Fedora 9 smbmount no longer worked properly with the
username%password syntax
  # Had to implement the auth file using the -A parameter
  smbauthfile=/tmp/smbauth.tmp
  echo "username=$SMB_USER" > $smbauthfile
  echo "password=$SMB_PASSWORD" >> $smbauthfile
  # set up the optional parameter for smbmount for using authentication
  auth_part="-A $smbauthfile"

else

  # set up default options - no authentication
  opts="-fstype=cifs"
fi

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

Quoted 11 lines

$SMBCLIENT $auth_part -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);

OK, so this is probably the correction I need to apply, but a patch would remove this line and add a brief description of the reasoning.

Quoted 7 lines
         print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
       }

END { if (!first) print "\n"; else exit 1 }
'
rm -f $smbauthfile

#32 lore raw
Quoted 12 lines
Quoted 6 lines
# optional authentication information
# either set it here or pass it in via the environment
# SMB_USER=
# SMB_PASSWORD

I don't think that embedding password information in a distributed example program map is the right thing to do. People need to work out how they will access authentication information for themselves and modify the example program map to suite.

Quoted 5 lines

Also, I don't understand how this can be set in the environment. If it is set in the daemon environment, typically root, and used for every mount then I don't think that is a good example of usage to distribute either.

This is just how I do it and thought it might help others who are perhaps wondering how to do it I did miss out one line - which is what you are puzzling over.
I include another script which contains SMB_USER and SMB_PASSWORD into the environment I have the line
. /etc/my_user_info
in my version of the script

Signature · 2 lines
Smartmon System Monitoring <http://www.smartmon.com.au>
www.smartmon.com.au

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs