Gentoo Archives: gentoo-user

From: Alexander Skwar <listen@×××××××××××××××.name>
To: gentoo-user@l.g.o
Subject: [gentoo-user] [slightly OT] Automounting Windows shares with autofs
Date: Fri, 01 Jun 2007 07:22:51
Message-Id: 2756389.PKGleWITSC@kn.gn.rtr.message-center.info
1 Good $time :)
2
3 I'm trying to setup my system so, that it can automount Windows shares.
4 I'd like to have it so, that I do NOT have to specify each and every
5 host and share in the automount configuration; I'd like to have it so,
6 that it's as "comfortable" as the NFS solution that you can get, if you
7 use /etc/autofs/auto.net. That's a (Gentoo supplied) executable script.
8 If invoked with the target hostname, it'll print all the available exports
9 on that NFS host and thus allows to use these exports. Eg.:
10
11 askwar@winnb000488 /dev/shm $ /etc/autofs/auto.net winds06
12 -fstype=nfs,hard,intr,nodev,nosuid,nonstrict,tcp,rsize=32768,wsize=32768,timeo=11,retrans=4,posix,nocto \
13         /opt/ORCLfmap winds06:/opt/ORCLfmap \
14         /pool winds06:/pool \
15         /pool/netbackup-catalog winds06:/pool/netbackup-catalog
16
17 So, on that winds06 host, there are 3 exports (ORCLfmap, pool and
18 netbackup-catalog). When I now do a "ls /net/winds06/pool", I'd
19 see what's in the pool export on winds06. In /etc/autofs/auto.master, I've
20 got:
21
22 /net /etc/autofs/auto.net
23
24 I'd like to get something like this for Samba hosts as well. As a
25 (dysfunctional :() start, I've hacked up a "auto.smb" script, which
26 you can find at <http://askwar.pastebin.ca/527240>. If invoked on the
27 command line, it returns:
28
29 askwar@winnb000488 /dev/shm $ /etc/autofs/auto.smb winfs001
30 -fstype=smbfs,credentials=/home/askwar/winfs001.cred \
31          R$      ://winfs001/R$ \
32          HOME    ://winfs001/HOME \
33          C$      ://winfs001/C$ \
34          DAITMeeting     ://winfs001/DAITMeeting \
35          DEPT    ://winfs001/DEPT \
36          APPL    ://winfs001/APPL \
37          F$      ://winfs001/F$ \
38          ADMIN$          ://winfs001/ADMIN$ \
39          WORKGROUPS      ://winfs001/WORKGROUPS \
40          D$      ://winfs001/D$ \
41          PUBLIC          ://winfs001/PUBLIC \
42          E$      ://winfs001/E$
43
44 Those are all the shares on the winfs001 host. In auto.master, I've got
45 the following:
46
47 /smb /etc/autofs/auto.smb
48
49 But it does not work :( When I do a "ls /smb/winfs001/DEPT", I get:
50
51 ls: cannot access /smb/winfs001/DEPT: No such file or directory
52
53 And in syslog:
54
55 ==> ./syslog <==
56 Jun 1 09:13:46 winnb000488 automount[15874]: >> Usage: mount.smbfs service mountpoint [-o options,...]
57 Jun 1 09:13:46 winnb000488 automount[15874]: >> Version 3.0.24
58 Jun 1 09:13:46 winnb000488 automount[15874]: >> Options:
59 Jun 1 09:13:46 winnb000488 automount[15874]: >> username=<arg> SMB username
60 Jun 1 09:13:46 winnb000488 automount[15874]: >> password=<arg> SMB password
61 Jun 1 09:13:46 winnb000488 automount[15874]: >> credentials=<filename> file with username/password
62 Jun 1 09:13:46 winnb000488 automount[15874]: >> krb use kerberos (active directory)
63 Jun 1 09:13:46 winnb000488 automount[15874]: >> netbiosname=<arg> source NetBIOS name
64 Jun 1 09:13:46 winnb000488 automount[15874]: >> uid=<arg> mount uid or username
65 Jun 1 09:13:46 winnb000488 automount[15874]: >> gid=<arg> mount gid or groupname
66 Jun 1 09:13:46 winnb000488 automount[15874]: >> port=<arg> remote SMB port number
67 Jun 1 09:13:46 winnb000488 automount[15874]: >> fmask=<arg> file umask
68 Jun 1 09:13:46 winnb000488 automount[15874]: >> dmask=<arg> directory umask
69 Jun 1 09:13:46 winnb000488 automount[15874]: >> debug=<arg> debug level
70 Jun 1 09:13:46 winnb000488 automount[15874]: >> ip=<arg> destination host or IP address
71 Jun 1 09:13:46 winnb000488 automount[15874]: >> workgroup=<arg> workgroup on destination
72 Jun 1 09:13:46 winnb000488 automount[15874]: >> sockopt=<arg> TCP socket options
73 Jun 1 09:13:46 winnb000488 automount[15874]: >> scope=<arg> NetBIOS scope
74 Jun 1 09:13:46 winnb000488 automount[15874]: >> iocharset=<arg> Linux charset (iso8859-1, utf8)
75 Jun 1 09:13:46 winnb000488 automount[15874]: >> codepage=<arg> server codepage (cp850)
76 Jun 1 09:13:46 winnb000488 automount[15874]: >> unicode use unicode when communicating with server
77 Jun 1 09:13:46 winnb000488 automount[15874]: >> lfs large file system support
78 Jun 1 09:13:46 winnb000488 automount[15874]: >> ttl=<arg> dircache time to live
79 Jun 1 09:13:46 winnb000488 automount[15874]: >> guest don't prompt for a password
80 Jun 1 09:13:46 winnb000488 automount[15874]: >> ro mount read-only
81 Jun 1 09:13:46 winnb000488 automount[15874]: >> rw mount read-write
82 Jun 1 09:13:46 winnb000488 automount[15874]: >> This command is designed to be run from within /bin/mount by giving
83 Jun 1 09:13:46 winnb000488 automount[15874]: >> the option '-t smbfs'. For example:
84 Jun 1 09:13:46 winnb000488 automount[15874]: >> mount -t smbfs -o username=tridge,password=foobar //fjall/test /data/test
85 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
86 Jun 1 09:13:46 winnb000488 automount[15874]: failed to mount /smb/winfs001
87
88 So, there's obviously something wrong - but what?
89
90 Automounting Windows shares does work with this in auto.master:
91
92 /winfs001 file:/etc/autofs/auto.winfs001
93
94 And auto.winfs001 being:
95
96 * -fstype=smbfs,credentials=/home/askwar/winfs001.cred,uid=askwar,gid=users,rw ://winfs001/&
97
98 But I don't want to have a line for every Windows host in my auto.master...
99
100 What do you guys do? I'm also NOT looking for a Gnome or even KDE only
101 solution. So anything using kioslaves is out of the question. It needs
102 to work normally on the command line as well.
103
104 Thanks a lot,
105 Alexander Skwar
106
107 PS: I know about <http://gentoo-wiki.com/HOWTO_Auto_mount_filesystems_(AUTOFS)>.
108 It's not what I'm looking for ;)
109
110 --
111 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] [slightly OT] Automounting Windows shares with autofs Dirk Heinrichs <dirk.heinrichs.ext@×××.com>