Skip to contentSkip to conversation

automounting smb share with options, and suggestion to use fstab entry for direct mounts without options and target

DISCUSSION [email protected] 2 participants 3 messages Feb 23, 2010 – Feb 24, 2010 Kernel automounter

lore
Share & tools
lore
#0 lore raw

hi!

i've got two issues with autofs, first one:

i want to mount an smb share. i have to pass username/password as well as the server's ip as a mount option (plus uid, gid, and all other smb options should be generally accessible using autofs, too, i guess). the following doesn't work:

/srv/smb -fstype=smbfs,ip=10.1.2.3,user=administrator,password=secret,uid=smbuser,gid=smbgroup //10.1.2.3/C$/

a mount command with these options (replacing the "-" by "-o ") _does_ work.
the funny thing is that such a manual mount won't work using 10.1.2.3:/C$/ notation, obviously because that already makes mount think the fstype must be nfs.

what i already found out is that the //<server>/<share>/ notation seems to cause problems to automount. using 10.1.2.3:/C$/ seems not to cause the same problem as when using mount (automount seems to still understand the fs type is smb) but it still fails, so it seems to mess up the other options somehow.

now that leads me to the second issue:

the above fs is in the fstab and currently has to be mounted manually when needed. now having that done by automount would be nice. that's a simple direct mount, so the idea is to simply add to auto.master:

/- /etc/auto.direct

and to add to /etc/auto.direct:

/srv/smb

now the options and target are missing - on purpose. what i mean/find most straightforward/find most intuitive, would be to have the possibility to just add the mountpoint to the direct mounts, so that automount will just mount the fs according to fstab (like when calling mount manually with the mountpoint as the only argument). that would btw. also fix/work around the issue #1 :)

as i mentioned, to me this seems most intuitive. obviously - as that's not (the way it was) implemented, others don't. but maybe it's still regarded as a nice thing to have?

regards,

Chris

maintainer
#1 lore raw
Quoted 4 lines · On 02/24/2010 01:55 AM, [email protected] wrote:

hi!

i've got two issues with autofs, first one:

Quoted 8 lines

i want to mount an smb share. i have to pass username/password as well as the server's ip as a mount option (plus uid, gid, and all other smb options should be generally accessible using autofs, too, i guess). the following doesn't work:

/srv/smb -fstype=smbfs,ip=10.1.2.3,user=administrator,password=secret,uid=smbuser,gid=smbgroup //10.1.2.3/C$/

You can't start a mount location with "/" because it will be interpreted as a path instead of a mount location. The sun ":" escape has always been used to cover this case.

eg.
/srv/smb -fstype=smbfs,.... ://10.1.2.3/C$/

Not sure if you will have a problem with the trailing "/", you'll need to check.

Quoted 31 lines

a mount command with these options (replacing the "-" by "-o ") _does_ work. the funny thing is that such a manual mount won't work using 10.1.2.3:/C$/ notation, obviously because that already makes mount think the fstype must be nfs.

what i already found out is that the //<server>/<share>/ notation seems to cause problems to automount. using 10.1.2.3:/C$/ seems not to cause the same problem as when using mount (automount seems to still understand the fs type is smb) but it still fails, so it seems to mess up the other options somehow.

now that leads me to the second issue:

the above fs is in the fstab and currently has to be mounted manually when needed. now having that done by automount would be nice. that's a simple direct mount, so the idea is to simply add to auto.master:

/- /etc/auto.direct

and to add to /etc/auto.direct:

/srv/smb

now the options and target are missing - on purpose. what i mean/find most straightforward/find most intuitive, would be to have the possibility to just add the mountpoint to the direct mounts, so that automount will just mount the fs according to fstab (like when calling mount manually with the mountpoint as the only argument). that would btw. also fix/work around the issue #1 :)

Quoted 3 lines

as i mentioned, to me this seems most intuitive. obviously - as that's not (the way it was) implemented, others don't. but maybe it's still regarded as a nice thing to have?

That's quite an interesting idea and, to be honest, I hadn't thought of doing it that way. I'm not sure if that could lead to problems though so I'd need to think about it for a while.

Ian

#2 lore raw

hi!

Quoted 3 lines · Ian Kent

You can't start a mount location with "/" because it will be interpreted as a path instead of a mount location. The sun ":" escape has always been used to cover this case.

ahok, sorry, i saw this construct but failed to find good documentation and just forgot about it...
what i also found out in the process: for a literal \ or $, they must be escaped (makes me curious about what can be done with $ - environment variables, i guess :). trailing / don't seem to make any troubles.

ok and to compensate for my bad conscience, attached a diff for the auto.master manpage, adding a paragraph describing the map format.

Quoted 2 lines
Quoted 2 lines

possibility to just add the mountpoint to the direct mounts, so that automount will just mount the fs according to fstab (like when

[...]

Quoted 1 line

I'd need to think about it for a while.

great to hear, thanks for considering the idea! :)

btw another point i stumbled over is that the (imho quite nice) /etc/init.d/autofs status feature seems to have been removed in rev. 5 - if it's not meant to come back eventually, i guess it were a good idea to remove it from autofs.8, too.

regards,

Chris

auto.master.5.in renamed from auto.master.5.in.orig +32 -0
@@ -157,6 +157,38 @@ command line.
 Set the timeout for caching failed key lookups. This option can be
 used to override the global default given either on the command line
 or in the configuration.
+.SH MAP FORMAT
+.P
+The format of a map is as follows:
+.TP
+.IR key	mount-options	target
+.TP
+.B key
+defines the key (which is the name of the directory inside the indirect map's mountpoint) in case of an indirect map, or the full mountpoint (probably always absolute, as there's no special context for a relative path) in case of a direct map.
+.TP
+.B mount-options
+defines the mount options used when the respective filesystem is mounted. The options here are the same as the options given after the -o switch of mount, but with a leading \fB-\fP (e.g. for \fBmount <mountpoint> -o fstype=smbfs,user=foo <target>\fP, the equivalent \fBmount-options\fP would be \fB-fstype=smbfs,user=foo\fP).
+.TP
+.B target
+defines the target which is to be mounted. Targets beginning with \fB/\fP are interpreted as files. To specify a path, a leading \fB:\fP must be added. \fB\[rs]\fP is the escape character. A literal \fB\[rs]\fP can be used but then must be escaped (e.g. \fB\[rs]\[rs]\fP). A literal \fB$\fP can be used but must be escaped (\fB\[rs]$\fP).
+.TP
+As an example, a line in a direct map might look like this:
+.sp
+.RS +.2i
+.ta 1.0i
+.nf
+/srv/smb-e     -fstype=smbfs,ip=192.168.1.2,user=administrator,password=secret,uid=root,gid=root       ://192.168.1.2/E\[rs]$/
+.fi
+.RE
+.sp
+And a line in an indirect map might look like this:
+.sp
+.RS +.2i
+.ta 1.0i
+.nf
+floppy         -fstype=auto            :/dev/fd0
+.fi
+.RE
 .SH GENERAL SYSTEM DEFAULTS CONFIGURATION
 .P
 The default value of several general settings may be changed in the

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