public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user]  [slightly OT] Automounting Windows shares with autofs
@ 2007-06-01  7:16 Alexander Skwar
  2007-06-01  8:55 ` Dirk Heinrichs
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Skwar @ 2007-06-01  7:16 UTC (permalink / raw
  To: gentoo-user

Good $time :)

I'm trying to setup my system so, that it can automount Windows shares.
I'd like to have it so, that I do NOT have to specify each and every
host and share in the automount configuration; I'd like to have it so,
that it's as "comfortable" as the NFS solution that you can get, if you
use /etc/autofs/auto.net. That's a (Gentoo supplied) executable script.
If invoked with the target hostname, it'll print all the available exports
on that NFS host and thus allows to use these exports. Eg.:

askwar@winnb000488 /dev/shm $ /etc/autofs/auto.net winds06
-fstype=nfs,hard,intr,nodev,nosuid,nonstrict,tcp,rsize=32768,wsize=32768,timeo=11,retrans=4,posix,nocto \
        /opt/ORCLfmap winds06:/opt/ORCLfmap \
        /pool winds06:/pool \
        /pool/netbackup-catalog winds06:/pool/netbackup-catalog

So, on that winds06 host, there are 3 exports (ORCLfmap, pool and 
netbackup-catalog). When I now do a "ls /net/winds06/pool", I'd
see what's in the pool export on winds06. In /etc/autofs/auto.master, I've
got:

/net    /etc/autofs/auto.net

I'd like to get something like this for Samba hosts as well. As a
(dysfunctional :() start, I've hacked up a "auto.smb" script, which
you can find at <http://askwar.pastebin.ca/527240>. If invoked on the
command line, it returns:

askwar@winnb000488 /dev/shm $ /etc/autofs/auto.smb winfs001 
-fstype=smbfs,credentials=/home/askwar/winfs001.cred \
         R$      ://winfs001/R$ \
         HOME    ://winfs001/HOME \
         C$      ://winfs001/C$ \
         DAITMeeting     ://winfs001/DAITMeeting \
         DEPT    ://winfs001/DEPT \
         APPL    ://winfs001/APPL \
         F$      ://winfs001/F$ \
         ADMIN$          ://winfs001/ADMIN$ \
         WORKGROUPS      ://winfs001/WORKGROUPS \
         D$      ://winfs001/D$ \
         PUBLIC          ://winfs001/PUBLIC \
         E$      ://winfs001/E$

Those are all the shares on the winfs001 host. In auto.master, I've got
the following:

/smb    /etc/autofs/auto.smb

But it does not work :( When I do a "ls /smb/winfs001/DEPT", I get:

ls: cannot access /smb/winfs001/DEPT: No such file or directory

And in syslog:

==> ./syslog <==
Jun  1 09:13:46 winnb000488 automount[15874]: >> Usage: mount.smbfs service mountpoint [-o options,...]
Jun  1 09:13:46 winnb000488 automount[15874]: >> Version 3.0.24
Jun  1 09:13:46 winnb000488 automount[15874]: >> Options:
Jun  1 09:13:46 winnb000488 automount[15874]: >>       username=<arg>                  SMB username
Jun  1 09:13:46 winnb000488 automount[15874]: >>       password=<arg>                  SMB password
Jun  1 09:13:46 winnb000488 automount[15874]: >>       credentials=<filename>          file with username/password
Jun  1 09:13:46 winnb000488 automount[15874]: >>       krb                             use kerberos (active directory)
Jun  1 09:13:46 winnb000488 automount[15874]: >>       netbiosname=<arg>               source NetBIOS name
Jun  1 09:13:46 winnb000488 automount[15874]: >>       uid=<arg>                       mount uid or username
Jun  1 09:13:46 winnb000488 automount[15874]: >>       gid=<arg>                       mount gid or groupname
Jun  1 09:13:46 winnb000488 automount[15874]: >>       port=<arg>                      remote SMB port number
Jun  1 09:13:46 winnb000488 automount[15874]: >>       fmask=<arg>                     file umask
Jun  1 09:13:46 winnb000488 automount[15874]: >>       dmask=<arg>                     directory umask
Jun  1 09:13:46 winnb000488 automount[15874]: >>       debug=<arg>                     debug level
Jun  1 09:13:46 winnb000488 automount[15874]: >>       ip=<arg>                        destination host or IP address
Jun  1 09:13:46 winnb000488 automount[15874]: >>       workgroup=<arg>                 workgroup on destination
Jun  1 09:13:46 winnb000488 automount[15874]: >>       sockopt=<arg>                   TCP socket options
Jun  1 09:13:46 winnb000488 automount[15874]: >>       scope=<arg>                     NetBIOS scope
Jun  1 09:13:46 winnb000488 automount[15874]: >>       iocharset=<arg>                 Linux charset (iso8859-1, utf8)
Jun  1 09:13:46 winnb000488 automount[15874]: >>       codepage=<arg>                  server codepage (cp850)
Jun  1 09:13:46 winnb000488 automount[15874]: >>       unicode                         use unicode when communicating with server
Jun  1 09:13:46 winnb000488 automount[15874]: >>       lfs                             large file system support
Jun  1 09:13:46 winnb000488 automount[15874]: >>       ttl=<arg>                       dircache time to live
Jun  1 09:13:46 winnb000488 automount[15874]: >>       guest                           don't prompt for a password
Jun  1 09:13:46 winnb000488 automount[15874]: >>       ro                              mount read-only
Jun  1 09:13:46 winnb000488 automount[15874]: >>       rw                              mount read-write
Jun  1 09:13:46 winnb000488 automount[15874]: >> This command is designed to be run from within /bin/mount by giving
Jun  1 09:13:46 winnb000488 automount[15874]: >> the option '-t smbfs'. For example:
Jun  1 09:13:46 winnb000488 automount[15874]: >>   mount -t smbfs -o username=tridge,password=foobar //fjall/test /data/test
Jun  1 09:13:46 winnb000488 automount[15874]: mount(generic): failed to mount R          ://winfs001/R           HOME    ://winfs001/HOME         C       ://winfs001/C           DAITMeeting     ://winfs001/DAITMeeting         DEPT    ://winfs001/DEPT        APPL    ://winfs001/APPL         F       ://winfs001/F           ADMIN   ://winfs001/ADMIN       WORKGROUPS      ://winfs001/WORKGROUPS          D       ://winfs001/D    PUBLIC          ://winfs001/PUBLIC      E       ://winfs001/E (type smbfs) on /smb/winfs001
Jun  1 09:13:46 winnb000488 automount[15874]: failed to mount /smb/winfs001

So, there's obviously something wrong - but what?

Automounting Windows shares does work with this in auto.master:

/winfs001       file:/etc/autofs/auto.winfs001

And auto.winfs001 being:

*               -fstype=smbfs,credentials=/home/askwar/winfs001.cred,uid=askwar,gid=users,rw    ://winfs001/&

But I don't want to have a line for every Windows host in my auto.master...

What do you guys do? I'm also NOT looking for a Gnome or even KDE only
solution. So anything using kioslaves is out of the question. It needs
to work normally on the command line as well.

Thanks a lot,
Alexander Skwar

PS: I know about <http://gentoo-wiki.com/HOWTO_Auto_mount_filesystems_(AUTOFS)>.
It's not what I'm looking for ;)

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user]  [slightly OT] Automounting Windows shares with autofs
  2007-06-01  7:16 [gentoo-user] [slightly OT] Automounting Windows shares with autofs Alexander Skwar
@ 2007-06-01  8:55 ` Dirk Heinrichs
  2007-06-01  9:52   ` Dirk Heinrichs
  0 siblings, 1 reply; 5+ messages in thread
From: Dirk Heinrichs @ 2007-06-01  8:55 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1944 bytes --]

Am Freitag, 1. Juni 2007 schrieb ext Alexander Skwar:
> I'd like to get something like this for Samba hosts as well. As a
> (dysfunctional :() start, I've hacked up a "auto.smb" script, which
> you can find at <http://askwar.pastebin.ca/527240>. If invoked on the
> command line, it returns:
>
> askwar@winnb000488 /dev/shm $ /etc/autofs/auto.smb winfs001
> -fstype=smbfs,credentials=/home/askwar/winfs001.cred \
>          R$      ://winfs001/R$ \
>          HOME    ://winfs001/HOME \
>          C$      ://winfs001/C$ \
>          DAITMeeting     ://winfs001/DAITMeeting \
>          DEPT    ://winfs001/DEPT \
>          APPL    ://winfs001/APPL \
>          F$      ://winfs001/F$ \
>          ADMIN$          ://winfs001/ADMIN$ \
>          WORKGROUPS      ://winfs001/WORKGROUPS \
>          D$      ://winfs001/D$ \
>          PUBLIC          ://winfs001/PUBLIC \
>          E$      ://winfs001/E$
>
> Those are all the shares on the winfs001 host. In auto.master, I've got
> the following:
>
> /smb    /etc/autofs/auto.smb
>
> But it does not work :( When I do a "ls /smb/winfs001/DEPT", I get:
>
> ls: cannot access /smb/winfs001/DEPT: No such file or directory

Hmm, I guess the output of your script is wrong. Put this line into the awk 
part instead:

{ if (first) { print opts; first=0 }; print " \\\n\t/"$1"\t://"host"/"$1 }

Nice Script, thanks :-) Only drawback of the script approach is that it 
makes automount's "-ghost" option useless.

Bye...

	Dirk
-- 
Dirk Heinrichs          | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: dirk.heinrichs@capgemini.com
Wanheimerstraße 68      | Web:  http://www.capgemini.com
D-40468 Düsseldorf      | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user]  [slightly OT] Automounting Windows shares with autofs
  2007-06-01  8:55 ` Dirk Heinrichs
@ 2007-06-01  9:52   ` Dirk Heinrichs
  2007-06-01 10:45     ` [gentoo-user] " Alexander Skwar
  0 siblings, 1 reply; 5+ messages in thread
From: Dirk Heinrichs @ 2007-06-01  9:52 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2044 bytes --]

Am Freitag, 1. Juni 2007 schrieb ext Dirk Heinrichs:
> Am Freitag, 1. Juni 2007 schrieb ext Alexander Skwar:
> > I'd like to get something like this for Samba hosts as well. As a
> > (dysfunctional :() start, I've hacked up a "auto.smb" script, which
> > you can find at <http://askwar.pastebin.ca/527240>. If invoked on the
> > command line, it returns:
> >
> > askwar@winnb000488 /dev/shm $ /etc/autofs/auto.smb winfs001
> > -fstype=smbfs,credentials=/home/askwar/winfs001.cred \
> >          R$      ://winfs001/R$ \
> >          HOME    ://winfs001/HOME \
> >          C$      ://winfs001/C$ \
> >          DAITMeeting     ://winfs001/DAITMeeting \
> >          DEPT    ://winfs001/DEPT \
> >          APPL    ://winfs001/APPL \
> >          F$      ://winfs001/F$ \
> >          ADMIN$          ://winfs001/ADMIN$ \
> >          WORKGROUPS      ://winfs001/WORKGROUPS \
> >          D$      ://winfs001/D$ \
> >          PUBLIC          ://winfs001/PUBLIC \
> >          E$      ://winfs001/E$
> >
> > Those are all the shares on the winfs001 host. In auto.master, I've got
> > the following:
> >
> > /smb    /etc/autofs/auto.smb
> >
> > But it does not work :( When I do a "ls /smb/winfs001/DEPT", I get:
> >
> > ls: cannot access /smb/winfs001/DEPT: No such file or directory
>
> Hmm, I guess the output of your script is wrong. Put this line into the
> awk part instead:
>
> { if (first) { print opts; first=0 }; print " \\\n\t/"$1"\t://"host"/"$1
> }

However, xxx$ shares don't work for me, which they do when entered in a 
static auto.windows.

Bye...

	Dirk
-- 
Dirk Heinrichs          | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: dirk.heinrichs@capgemini.com
Wanheimerstraße 68      | Web:  http://www.capgemini.com
D-40468 Düsseldorf      | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-user]  Re: [slightly OT] Automounting Windows shares with autofs
  2007-06-01  9:52   ` Dirk Heinrichs
@ 2007-06-01 10:45     ` Alexander Skwar
  2007-06-01 12:41       ` Dirk Heinrichs
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Skwar @ 2007-06-01 10:45 UTC (permalink / raw
  To: gentoo-user

Dirk Heinrichs <dirk.heinrichs.ext@nsn.com> wrote:

> Am Freitag, 1. Juni 2007 schrieb ext Dirk Heinrichs:

>> Hmm, I guess the output of your script is wrong. 

Guess so as well :)

>> Put this line into the 
>> awk part instead:
>>
>> { if (first) { print opts; first=0 }; print " \\\n\t/"$1"\t://"host"/"$1
>> }

Thx. This works. The difference is, that you're printing "/DEPT", while
I was printing just "DEPT" - IOW: you added a / before the Sharename.
Strange that this is required, though, because in a static map, the
/ isn't required.

Oh, well. As long as it works ;)

> However, xxx$ shares don't work for me, which they do when entered in a
> static auto.windows.

Yep. If you have a close look at the syslog, you'll find:

        D       ://winfs001/D

So, for some reason, it's loosing the $. Maybe add quotes? Or escape?
Let's see...

Yep. Escaping seems to be in order.

See http://askwar.pastebin.ca/527548 for the new version of the script.

--- post.527240 2007-06-01 04:42:37.284685294 -0600
+++ post.527548 2007-06-01 04:42:37.284685294 -0600
@@ -6,8 +6,11 @@
 
 /usr/bin/smbclient -A "$cred_file" -L "$host" 2>/dev/null | \
        grep Disk | \
+       sed s/\\$/\\\\$/g | \
        awk -v host="$host" -v opts="$opts" -- '
        BEGIN           { ORS=""; first=1 }
-                       { if (first) { print opts; first=0 }; print " \\\n\t", $1, "\t ://" host "/" $1 }
+                       { if (first) { print opts; first=0 }; print " \\\n\t /"$1" \t ://"host"/"$1 }
        END             {  print "\n"; }
        '
+
+

http://askwar.pastebin.ca/diff.php?id1=527240&id2=527548

This fails with a much better error message for me ;)

Jun  1 12:39:23 winnb000488 automount[17344]: mount(generic): failed to mount //winfs001/D$ (type smbfs) on /smb/winfs001/D$
Jun  1 12:39:23 winnb000488 automount[17344]: >> 17411: tree connect failed: ERRDOS - ERRnoaccess (Access denied.)
Jun  1 12:39:23 winnb000488 automount[17344]: >> SMB connection failed

Yep. I'm not allowed access to D$. This can very well be.

Cheers and thanks for the help!
Alexander Skwar

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user]  Re: [slightly OT] Automounting Windows shares with autofs
  2007-06-01 10:45     ` [gentoo-user] " Alexander Skwar
@ 2007-06-01 12:41       ` Dirk Heinrichs
  0 siblings, 0 replies; 5+ messages in thread
From: Dirk Heinrichs @ 2007-06-01 12:41 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1711 bytes --]

Am Freitag, 1. Juni 2007 schrieb ext Alexander Skwar:
> Dirk Heinrichs <dirk.heinrichs.ext@nsn.com> wrote:
> > Am Freitag, 1. Juni 2007 schrieb ext Dirk Heinrichs:
> >> Hmm, I guess the output of your script is wrong.
>
> Guess so as well :)
>
> >> Put this line into the
> >> awk part instead:
> >>
> >> { if (first) { print opts; first=0 }; print "
> >> \\\n\t/"$1"\t://"host"/"$1 }
>
> Thx. This works. The difference is, that you're printing "/DEPT", while
> I was printing just "DEPT" - IOW: you added a / before the Sharename.
> Strange that this is required, though, because in a static map, the
> / isn't required.

You mentioned auto.net in your first mail. This one also prints a 
leading "/".

> > However, xxx$ shares don't work for me, which they do when entered in a
> > static auto.windows.
>
> Yep. Escaping seems to be in order.
>
> See http://askwar.pastebin.ca/527548 for the new version of the script.
>
> This fails with a much better error message for me ;)
>
> Yep. I'm not allowed access to D$. This can very well be.

I see a different picture :-(. It seems to be the sheer mass of shares on 
that server. From the syslog, it looks like the automounter tries to mount 
every share until it runs out of memory.

That would explain why my static (direct) map works, while the dynamic one 
doesn't.

Bye...

	Dirk
-- 
Dirk Heinrichs          | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: dirk.heinrichs@capgemini.com
Wanheimerstraße 68      | Web:  http://www.capgemini.com
D-40468 Düsseldorf      | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-06-01 12:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-01  7:16 [gentoo-user] [slightly OT] Automounting Windows shares with autofs Alexander Skwar
2007-06-01  8:55 ` Dirk Heinrichs
2007-06-01  9:52   ` Dirk Heinrichs
2007-06-01 10:45     ` [gentoo-user] " Alexander Skwar
2007-06-01 12:41       ` Dirk Heinrichs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox