Skip to content

Automatic opening a USB disk on Sun Ray

March 25, 2008

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 she could know this.

So I need a way to get the file browser to open when the drive is inserted. A quick google finds ” “USB Drive” daemon for Sun Ray sessions” which looks like the answer. The problem I have with this is that it polls to see if there is something mounted. Given my users never log out this would mean this running on average every second. Also the 5 second delay just does not take into account the attention span of a teenager.

There has to be a better way.

My solution is to use dtrace to see when the file system has been mounted and then run nautilus with that directory.

The great thing about Solaris 10 and later is that I can give the script just the privilege that allows it to run dtrace without handing out access to the world. Then of course you can then give that privilege away.

So I came up with this script. Save it. Mine is in /usr/local which in turn is a symbolic link to /tank/fs/local. Then add an entry to /etc/security/exec_attr, subsisting the correct absolute (ie one with no symbolic links in it) path in the line.

Basic Solaris User:solaris:cmd:::/tank/fs/local/bin/utmountd:privs=dtrace_kernel

This gives the script just enough privileges to allow it to work. It then drops the extra privilege so that when it runs nautilus it has no extra privileges.

Then you just have to arrange for users to run the script when they login using:

pfexec /usr/local/bin/utmountd

I have done this by creating a file called /etc/dt/config/Xsession.d/utmountd that contains these lines:

pfexec /usr/local/bin/utmountd & trap "kill $!" EXIT

I leave making this work for uses of CDE as an exercise for the reader.


From → Solaris

  1. This is all terrible. I should really pull myself together and finish the Tamarack support for Sun Ray.

  2. EdwardOCallaghan permalink

    Good job on the work around but I must agree that this is by no means a solution. It should also not depend on what WM one uses ether.
    I would say that a user should by todays standard’s expect HAL to find the hardware such as a USB HDD / Pen drive or CD/DVD/BlueRay and mount it.
    Bring up any file manager should be the job of the WM like KDE4/Gnome/Fluxbox by talking with HAL.
    Unless I am miss understanding something?

  3. I could not agree more. This should not be needed but currently it is.

  4. cale permalink

    Your link to the dtrace-script seems not valid anymore. Could you please correct it or send me the script via mail. Thanks for this and your great blog (helped me a lot getting VDI 3.1.1 to work on opensolaris snv_134).

  5. chrisgerhard permalink


    I have fixed the link. Thank you for your patience.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: