Local Drive Access
IMPORTANT: If you're running LTSP 4.2, the page you want to read is
LTSP-42-LocalDev
Introduction
LDA(Local Drive Access) allows LTSP users to read or write data to a floppy or read data from a CD-ROM. Currently LDA supports CD-ROMs, floppies, DVDs, and USB memory sticks in read/write mode only. This means that users can not burn, play or rip a CD. They may however copy data from the storage device to their home directory. The server configuration can be somewhat involved if you want any level of security.
Disclaimer
Neither the author nor the distributors, or any other contributor of this document are in any way responsible for physical, financial, moral or any other type of damage incurred by following the suggestions in this text.
Copyright and License
This document is copyright 2004 by Richard June, and is released under the terms of the GNU Free Documentation License, which is hereby incorporated by reference.
Theory of Operation
Steps on the terminal
The terminal first mounts the local devices with supermount. This ensures that the device will only get used when it is requested. (CD/DVD drives for example will lock the door when mounted). The terminal generates a samba configuration(it is
very basic) and shares the devices. At this point you can go to Start->Run("smb://nobody@<IP_OF_TERMINAL>/drives") and browse for devices on the terminal.
Steps on the server
The server must mount the share for the user in the users home directory. Currently we have settled on ${HOME}/drives, this is done via script.
(note: you can skip server scripts and mounting by accessing the samba Share directly from konqueror, using the following command:
konqueror smb://`echo $DISPLAY | cut -f 1 -d ':'`/drives/floppy
Substitute cdrom for floppy to access the cdrom. This line can be included in an icon on your desktop for easy access)
Requirements
Requirements for the terminal
Your terminal needs some sort of local drive, currently supported media include: floppy, CD-ROM, and an IDE hard disk. USB drives are also supported by USB hotplugging. Current USB devices supported are USB floppies, CD-Roms, and thumb drives.
Requirements for the server
Requirements for the server are fairly light. You must install the ltsp_localdev package, usually through ltspadmin. And you must install the samba package, specificly you must have smbmount. On a Debian based distro,
apt-get install smbfs will get you the support you need. On a Fedora based distro,
yum install samba-client should do the trick.
Configuration
lts.conf
LDA has two options:
LOCAL_DEVICE_XX = /dev/<device>:<devicename>. XX is a two digit number starting at 01 and ending at 10. You may put this configuration option in either global or per machine configuration. These entries configure IDE based devices, or standard floppies. We show a common configuration for both cdrom and floppy below.
LOCAL_DEVICE_01 = /dev/hdc:cdrom
LOCAL_DEVICE_02 = /dev/fd0:floppy
(note--on Fedora 4 I had to add "MODULE_01 = ide_generic" to get CD-Roms working--
KenTanzer - 13 Feb 2006)
The second option is:
HOTPLUG = Y. This turns on hotplugging support for USB devices. Since the initial 4.1.1 release of LTSP, the hotplugging scripts have been updated to fix some bugs, and add some extra features. The updated hotplugging files are included at the bottom of the page, via the attached files link. This update detects most usb devices automatically by default, but if you'd like to restrict this to devices that you only list in /opt/ltsp/i386/etc/usblist, you can specify the
ALLOW_UNKNOWN_USB = N variable in the lts.conf file, and this will disable the more permissive detection.
(note--on Fedora 4 I had to edit LTSP_DIR/i386/etc/rc.usb to get USB drives to work. Simply add 'usb-storage' (without quotes) after the usbkbd module. --
PatrickNoffke - 11 Mar 2006)
Scripts
LDA is setup by a number of scripts.
First, download this script and replace the rc.localdev script in $LTSP_ROOT/etc
http://www.bravegnuworld.com/~rjune/ltsp/local_drives/scripts/rc.localdev
The above script is only needed for LTSP 4.1, NOT for LTSP-4.1.1 !
Next, download the following two scripts and put them in /usr/local/bin
LDA-setup.sh
LDA-shutdown.sh
if you use KDM:
/usr/local/bin/LDA-setup.sh goes into line 3 of /etc/kde/kdm/Xstartup
/usr/local/bin/LDA-shutdown.sh goes into line 3 of /etc/kde/kdm/Xreset
Mandriva 2005LE (Mandrake 10.2) Note:
The file: /etc/kde/kdm/kdmrc in Mandriva doesn't point to Xstartup and Xreset but rather to:
/etc/X11/xdm/GiveConsole and
/etc/X11/xdm/TakeConsole
so you can put the above lines in these files instead
if you use GDM:
/usr/local/bin/LDA-setup.sh goes into line 3 of /etc/X11/gdm/PostLogin/Default
/usr/local/bin/LDA-shutdown.sh goes into line 3 of /etc/X11/gdm/PostSession/Default
Troubleshooting
Terminal problems
For testing purposes, put
SCREEN_02 = shell in the lts.conf section for the terminal. Restart the terminal, login, and hit
<ctrl>-<alt>-<F2> This will drop you right into a shell. Run mount|grep supermount, you should see entries corresponding with your lts.conf entries from chapter 4.1(in our case floppy and CD-ROM. If you do not see this, you probably have either hardware problems or your entries in lts.conf are not correct. Next, put a disc in the drive and ls /tmp/drives/<device>. If you do not see a list of information on the drive, you problably have either a bad drive or did not put the disk in. The last thing to check is samba, to do this, login to the server, open up the file-manager(either Konqueror or Nautilus), then type in smb://nobody@>terminal_IP> in the addressbar. You should see the devices you configured earlier listed, commonly cdrom and floppy. Upon opening either device, you should see the contents of the folder.
Server problems
Once you have gone through all the testing in the previous section, you must look to the server as the cause of your problems. Since the only thing the server uses is smbmount, the samba packages must be installed. Use mount to verify that the drives share is mounted to ${HOME}/drives. Make sure in GDM that the /etc/X11/gdm/PostLogin/Default and /etc/X11/gdm/PostSession/Default files are set executable.
Writing trouble (smbfs)
With ltsp 4.1, samba 3.0.4 and linux 2.4.26 as shipped. When mounting local drives on the server using smbfs, writing to the device may fail and give the following log message on the server:
kernel: smb_add_request: request [1234abcd, mid=1] timed out!
Adding
unix extensions = No to the client's
smb.conf (section
[global]) has been
reported to work around it. You can do that by adding it to /opt/ltsp/i386/etc/rc.localdev around line 45.
With ltsp 4.1.1, with the updated hotplug scripts below, this should be fixed.
Where to find help
If you find that your problems with LDA are beyond this document. Visit
http://www.ltsp.org/irc.php for information on Joining #ltsp on irc.freenode.net.
Update Files
Here's where we'll provide quick updates as needed.
Local CD Burning
See
LocalCDWriting for details on how to do this. The config changes for LDA mentioned above are not used/needed for Local CD Burning.
Integration using the automounter (autofs) and Nautilus
This approach uses the Linux automounter (autofs) to mount the drive share off the clients. This keeps the users's from having to browse to the samba shares in order to use the files on their disks. The directories automounted are somewhat secure in that only the user logged into that client is given ownership of the directory and files (on the server end, nothing has been changed for the client end Samba security). There is a final script that runs when the user logs in under Gnome which makes an icon appear under "Computer" as well as their desktop which points to their automounted directory. This is updated/removed as appropriate when the user's log in. The default name for the desktop icon is "My Disks"
Here we go!
Instructions
Follow the above setup for
LocalMedia, except do not use the scripts above! Extract the following scripts and install them to /usr/local/bin:
LDA-automount.tar.gz.
You need to create the directory /var/lib/localdev as this is where the client-> username files are stored that the automounter uses.
Save the
auto.localdev file to /etc/ and edit your /etc/auto.master to include this:
/mnt/localdev /etc/auto.localdev --timeout=60
Here is a note of warning. Some versions of
RedHat?/Fedora have broken handling of Samba mounts under autofs. That bug is fixed in Centos 4.1/RHEL 4.1(and probably new versions of Fedora Core above 2). See the auto.localdev file for a little bit more information, but it basically involves removing a ":" at the end of the script if yours doesn't automount.
Restart autofs by doing
service autofs restart.
Using GDM:
/usr/local/bin/LDA-automount-login.sh goes into /etc/X11/gdm/PostLogin/Default
/usr/local/bin/LDA-automount-logout.sh goes into /etc/X11/gdm/PostSession/Default
Nautilus Integration
Edit the file /usr/share/gnome/default.session and add the following entry at the end (adjusting the beginning numbers as appropriate to your configuration. Also, make sure num_clients is equal to the last-1.
7,RestartStyleHint=3
7,Priority=52
7,RestartCommand=/usr/local/bin/LDA-nautilus.sh
This script updates the gconf connected_servers entry having to do with
LocalMedia.
Hopefully I haven't forgotten anything but you can reach me @
HenryBurroughs
--
AndrewZ - 14 Oct 2005
To get "Integration using the automounter (autofs) and Nautilus" working, I made two changes:
chmod a+rx /var/lib/localdev # not chmod 700 as given by /etc/auto.localdev
chmod +x /etc/auto.localdev
Also be careful editing /etc/X11/gdm/PostSession/Default because it may end with
exit 0, so any code placed at the end will never execute.
Unicolet Method
The Unicolet method is similar to the Nautilus method above in that the Unicolet method mounts drives in kernel space, so that all programs can access the files. On the other hand, the Unicolet method is currently a bit specific to KDE/Konqueror (but reportedly easily adapted to Gnome/Nautilus).
See
this thread for a discussion about an alternative approach, which is documented
here.
A patch for using this approach successfully in GNU/Debian sistems is on
www.SuperAlberT.it.
LTSPFS - The LTSP FileSystem?
See
LtspFS for the experimental, next-generation file system for LTSP systems.
Mounting
To automatically mount
LtspFS drives under
~/drives during GNOME login, follow this procedure.
- Install LtspFS according to the instructions on the page LtspFS.
- Download the script LDA-mount-ltpfs.sh.
- Install the script according to the instructions within.
Integration with GNOME Nautilus
To integrate
LtspFS with GNOME Nautilus, follow this procedure
- Setup LtspFS mounting (above).
- Download Henry Burroughs' LDA-automount.tar.gz.
- Setup and install only the one script
LDA-nautilus.sh from LDA-automount.tar.gz.
TODO: Maybe the
LDA-automount-logout.sh from
LDA-automount.tar.gz is required too? Does it need changes?
Security notice for users
In conjunction with the popular SMB LDA, this patch for rc.localdev creates a file which provides a security notice to users.
--- rc.localdev.original-ltsp411 2005-10-14 09:07:42.000000000 -0600
+++ rc.localdev 2005-10-14 09:30:38.000000000 -0600
@@ -104,5 +104,8 @@
guest ok = Yes
locking = no
EOF
+ echo "Local media (such as floppies, CD-ROM, and USB drives) in this directory are not protected by password, so they are not secure. To prevent authorized access and tampering by people on the local network, you take these precautions:" >> /tmp/drives/readme-security.txt
+ echo " * Do not use the terminal server to access confidential information on local media." >> /tmp/drives/readme-security.txt
+ echo " * Remove local media after use." >> /tmp/drives/readme-security.txt
smbd -D -s /tmp/smb.conf
fi
--
AaronFeldman - 16 Oct 2005
--
HenryBurroughs - 19 Sep 2005
--
AlberT - 13 Sep 2005
--
JPMcC - 22 Aug 2005