A "USB Drive" daemon for Sun Ray sessions

\*\*\*\* THIS VERSION OF usbdrived IS DEPRECATED - see \*\*\* http://blogs.sun.com/danielc/entry/a_usb_drive_daemon_for1


A lot of people ask me the age-old question: how can I see thumb drives (and others) attached to my Sun Ray on JDS/CDE/Windows? (it probably works unchanged for SLES and RHEL.)

The inelegant, user-unfriendly solution that is always there for you (JDS/CDE):
Without doing any further work, the answer is quite trivial: SRSS mounts the thumb drive on a non-trivial directory (non-trivial as in "not in your home directory") - namely at:

/tmp/SUNWut/mnt/<user-name>

(mounted disk names and #s appear here)

You can then access this via the file manager - for example, in JDS, (right-click) Launch -> Browse Documents (Nautilus) and point to this directory. Better yet - bookmark this directory under Nautilus as soon as you can!

However, the above is typically unacceptable for customer deployments, and until the time Solaris/JDS can handle this automatically, I've scripted a couple of workarounds. See next section.

The elegant solution: "USB Daemon (usbdrived)"
The following instructions will automate USB drive "show-up" so that when you insert a thumbdrive into your Sun Ray:
1) a file manager window (Nautilus) will automatically open up showing the top-level directory of the USB drive, and
2) a link is created on your desktop, called "USB Drive" (I just couldn't come up with a better name...)

Once you pull the drive out, the above disappear, so it's important to make sure that any copying process is done before pulling it out. (actually, the file manager window disappears only if its on the root level of your USB drive. If anyone can tell me how to close any Nautilus window that's open on sub-directories, please let me know!)

The instructions here also integrate the script with utaction so that disconnected users don't chew up unnecessary Sun Ray server resources.

HOW TO (Basic instructions for JDS):
These instructions assume that you'll install this for your user account. Extrapolate for server-wide deployment as required...

1) If you don't have one, create a bin directory in your home directory
- run this: mkdir $HOME/bin

2) copy usbdrived to your newly created "bin" and give it exec permissions
- run this: chmod +x $HOME/bin/usbdrived

[NOTE: THIS LINK IS DEPRECATED AND NOW POINTS TO BLOG ENTRY FOR V2!]

3) If you're running version 1.23 or better of utdiskadm, skip to step 6. To find out, this command will tell you the version number
- run this: head /opt/SUNWut/bin/utdiskadm | grep ident | awk '{ print $4 }'

4) If you're on version 1.22 or lower of utdiskadm you need to patch an 'alternate' version that includes a little fix: copy the standard utdiskadm to your bin directory (call it utdiskadm.fix) and change one line (because, under certain circusmtances, logname returns nothing...) - the script will probe for an up-to-date utdiskadm and ignore yours when the system has been patched as required!
- run this: cp /opt/SUNWut/bin/utdiskadm $HOME/bin/utdiskadm.fix
                vi $HOME/bin/utdiskadm.fix
                find the line UTUSERNAME="`logname`"
                change to UTUSERNAME=$USER
                :wq (save the file ;)

5) If you are \*not\* placing the updated utdiskadm.fix file in your bin directory, update your "usbdrived" script to reflect the location of utdiskadm.fix.

6) add a line to your .profile (bash/ksh/sh) or .login (csh) in your home directory that will enable the daemon on card insertion (change the path accordingly if the script is not in your bin directory)
- run this: echo '/opt/SUNWut/bin/utaction -c  "$HOME/bin/usbdrived start" -d  "$HOME/bin/usbdrived stop" -i &' >> $HOME/.profile   (or .login if csh)

7) Log out, log in... That's it. (or you can run the above line to test as a one-off until you log out).

Under CAM/CDE
If your are using CAM/CDE, make sure you edit the script and change the USEJDS variable to 0, so that:
1) Nautilus is not invoked automatically (though you can, but...)
2) The "USB Drive" link is created in the user's home dir and not the Desktop dir, which doesn't exist

You can then add a CAM menu entry to open dtfile on this, such as "Open My USB Drive". You do this anyway without usbdrived by following the earlier section, but it won't open in the exact mount, but rather in the parent folder. These instructions are particularly useful for the next section...

Under Windows
You need to run the daemon like above under either JDS or CDE (whatever it is you are using underneath) and make sure you start up uttsc with the appropriate -r option, e.g. -r disk:U="$HOME/Desktop/USB Drive" for JDS. This will let you browse the U: drive when there is something mounted, and it will allow for changing USB drives without disconnecting your Windows session, as usbdrived depends on utdiskadm to create the "USB Drive" link on demand.

Make sure that if you are using CAM with the Sun Ray Windows Connector, you make USEJDS=0 in the usbdrived script.

Limitations
This only allows for one USB drived at a time to show up and be managed. That's enough for now ;) 

Comments:

Spot on little script, Thanks. Just dropped it on to a Test server and it works fine in JDS. I'm a little concerned that you seem to suggest a CAM User can mount a USB Drive. Correct me if i'm wrong but that needs privileges not granted as standard to a CAM User. There is however a nice little hack posted elswhere that grabs a list of Kiosk Users, creates a mount point and changed the permissions.

Posted by Alex Collins on June 20, 2007 at 01:41 AM PDT #

I think that one of the problems that people are seeing now with this type of solution is that there are now thumb drives with more than one partition. Typically these are "U3" enabled drives. One partition is a read only partition and the other us the standard FAT32. I think that the best way to manage these would be to only link the RW partition to "USB Disk" and ignore the U3 partition. Windows users will be out of luck with U3, but that's probably not a huge deal.

Posted by bhlackey on June 20, 2007 at 04:57 AM PDT #

Hello, this afternoon with a colleague we end up creating the following script. We tested it under gnome CSW but should work on JDE and on CDE with some little modification It's called usbdrived3 because number 2 is in Italian :-)

It create link on usb key insert and delete them on usb key remove for any number key. Tested with a U3 one too.

The script can be found at usbdrived3

We'll try to improve it, if you create another version please let us know

Bye bye
Frank Contrepois

Posted by Frank Contrepois on June 21, 2007 at 01:01 AM PDT #

Alex - you're correct, the script will work under CAM as long as you create the appropriate mount points. I'm not sure I've ever used the hack, but I have previously scripted for CAM at boot time the creation of the mount points (don't forget they'll get deleted on reboot).

Posted by danielc on June 21, 2007 at 12:21 PM PDT #

Frank - when I get hold of a U3 drive to test on, I'll have a careful look at the script again. The published one is version 4 already ;) The current structure would allow easily for simply expanding to all partitions, but for now I'm catering for the audience that just carries files around for a living. Thanks!

Posted by danielc on June 21, 2007 at 12:33 PM PDT #

Hi.
To Create the mount points correctly you need this little script. I don't take credit for the work, Brad Lackey from Sun gave me this.
CAM_Storage_Fix.tar.gz

If you are using Kiosk Mode think carefully about the implications of using this script. A user may be able to browse your entire file system.

Posted by Alex Collins on June 21, 2007 at 06:29 PM PDT #

One remaining challenge I seem to have is when I want the mounted USB from Windows Terminal server to SRS to client that is actually connected via a DSL connection over the internet. What isnt obvious is what port and connection type is this traversing? I can get it all to work fine in lab, but when I go through firewall it seems to get blocked. Any thoughts?

Posted by Carl Eberling on June 25, 2007 at 12:05 AM PDT #

[Trackback] One of my users today had a bit of a hissy fit today when she plugged in her USB thumb drive into the Sun Ray and it did nothing. That is it did nothing visible. Behind the scenes the drive had been mounted somewhere but there was no realistic way ...

Posted by The dot in ... --- ... on March 26, 2008 at 11:24 PM PDT #

Is there a way to have USB devices mounted read-only? vold (on a workstation) can be told to do so, but I didn't find out how that can be done with a Sun Ray...

Posted by Norbert Hanke on July 03, 2008 at 12:38 AM PDT #

There is a third party solution, which implements direct USB passthrough from Sun Ray to Windows Terminal Server and XP.

Allows to connect printers to Terminal Server with native Windows drivers, and virtually any USB device to virtual XP machine.

Posted by Pavel Tatarintsev on April 20, 2009 at 11:31 PM PDT #

Pavel, can you please share with us who this third party is? I am more than curious.

Posted by Daniel Cifuentes on April 22, 2009 at 12:19 AM PDT #

This is Russian company I work for - UBTec. The solution is called NETUSB. And it specifically designed for Sun Rays.

You can reach me by phone +7 918 531 81 95, or +7 863 295 31 00 ext.513 or e-mail: tatarintsev AT ubtec.ru

Posted by Pavel Tatarintsev on April 22, 2009 at 05:14 AM PDT #

Dear Sun/Oracle,

SunRay is great technology, good approach... thin of the thinness clients (ultra thin client).

But it's a weak product. Sometimes technology people need to go out get some beers, relax and develop cool product. Here are the essentials:

USB 2.0 or even 3.0 - MUST. Other wise don't include USB port at all. For those who don't use it. To make it even more attractive add flash card reader. Also we need more USB's 2 spare ports at least. Keyboard USB extensions does not work. Not enough voltage.

Multimedia. 2 way sound (mic/playback) all way to windows through RDP.

Video acceleration. Any DVD player in these days can decode DivX, Mpeg-2, Mpeg-4. Make it 30W instead 4W but users need multimedia on their desktops. You tube full screen should scream.

Power save button. 4W is 4W. put an extra button for power save. Go green.

Cheers and good luck.

Posted by Saul Pr on May 22, 2009 at 12:04 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

Think Thin is a collection of bloggers that work with Oracle's Virtual Desktop portfolio of products.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today