1 AUTHOR: Stef Bon <stef at bononline dot nl>
5 LICENSE: GNU Free Documentation License Version 1.2
7 SYNOPSIS: Starting and stopping Fusesmb at a KDE-session using KDM.
10 This hint is about starting the sessionpart of the fusesmb.
12 This is based on my hint
13 "Execute scripts at begin and end of a KDE-session using KDM".
15 In this hint is described in general how scripts and commands are
16 started at the begin and end of a KDE session using KDM.
22 This hint requires sufficient knowledge of LINUX in general, and scripts in particular.
23 Futher sudo should be installed, and you should start KDE via KDM.
30 1. Browsing the network using FUSE, fusesmb and PAM
31 1.1 Installation of FUSE and FuseSMB.
36 ---------------------------------------------------
37 1. Browsing the network using FUSE, fusesmb and PAM
38 ---------------------------------------------------
40 Very new is FUSE. At this moment the FUSE package contains a kernelmodule, a library and utilities.
41 Soon the module will be standard in the kernel. For more information see the website of course.
43 -------------------------------------
44 1.1 Installation of FUSE and FuseSMB.
45 -------------------------------------
47 Get FUSE from the projectsite:
49 http://fuse.sourceforge.net
54 ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-kernel-module --enable-lib --enable-util
58 A module is installed, fuse.
64 and add it to /etc/sysconfig/modules.
68 In the newest kernels (>=2.6.14) the kernelmodule is included in the kernel. You still
69 need the package above, because of the library and the utilities.
71 Configuration of fuse goes via the fuse.conf file in the /etc directory:
73 cat >> /etc/fuse.conf << "EOF"
84 http://freshmeat.net/projects/fusesmb/
89 ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
93 It requires samba-3.0.*.
102 Now the actual scripts:
104 cd /etc/session.d/kdm/startup
106 cat >> fusesmb.sh << "EOF"
112 userproperties=$(getent passwd | grep -m 1-E "^$userid")
113 homedir=$(echo $userproperties | cut -d ":" -f 6);
114 gidnr=$(echo $userproperties | cut -d ":" -f 4);
115 uidnr=$(echo $userproperties | cut -d ":" -f 3);
117 if [ -d $homedir ]; then
119 if [ ! -d $homedir/network ]; then
120 mkdir -p $homedir/network
121 chown $uidnr:$gidnr $homedir/network
124 if [ $(id -u) -eq 0 ]; then
125 sudo -H -u $userid /bin/sh -c "fusesmb $homedir/network -o fsname=fusesmb,default_permissions,allow_other"
127 elif [ $(id -u) -eq $uidnr ]; then
128 fusesmb $homedir/network -o fsname=fusesmb,default_permissions,allow_other
134 if [ $retcode -ne 0 ]; then
135 echo "An error with fusesmb ($retcode)."
142 Now with fusesmb running you can access your SMB(Windows)
143 network environment via a filesystem in userspace, with
144 **any** (not only KDE apps with kio's or GNOME with vfs)
145 application, like MC or vi.
147 This configuration allows other users to enter the fusesmb filesystem. If you don't want this, you should remove
148 the "allow_other" flag.
151 ------------------------
152 1.3 Stopping of fusesmb.
153 ------------------------
155 And the logout script:
157 cd /etc/session.d/kdm/reset
159 cat >> fusesmb.sh << "EOF"
165 userproperties=$(getent passwd | grep -m 1 -E "^$userid")
166 homedir=$(echo $userproperties | cut -d ":" -f 6);
167 gidnr=$(echo $userproperties | cut -d ":" -f 4);
168 uidnr=$(echo $userproperties | cut -d ":" -f 3);
170 if [ -d $homedir ]; then
172 if [ -n "$(mount | grep $homedir/network)" ]; then
174 fusermount -u $homedir/network
181 if [ $retcode -ne 0 ]; then
182 echo "An error with fusesmb ($retcode)."
200 * deleted everything about PAM