Tuesday, August 25, 2009

NFS Users

I recently needed to share the same directory between Samba and NFS. The main problem was that Samba accounts were mapped to users and NFS was not. NFS accounts can also be mapped to users by adding the following to /etc/exports


path_to_share computer_name(rw,all_squash,anonuid=xxx,anongid=yyy)


anonuid is the user id to map to and anongid is the group id to map to when a client from the computer_name connects to the share.

You can find out the user id and group id of a user with


id user_name


Use the value of uid and gid to be anonuid and anongid respectively.

Now when a user from computer_name connects to the share, he connects as user uid and of group gid.

Linux File System Info

A quick way to find the file system of a particular block device is to use



sudo vol_id device


Eg.


sudo vol_id /dev/sda1


Which would produce something like the following:


ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID=......
ID_FS_UUID_ENC=...
ID_FS_LABEL=
ID_FS_LABEL_ENC=


You can also use vol_id to generate a uuid for a device


sudo vol_id --uuid device


Eg.

sudo vol_id --uuid /dev/sda1



If you have parted installed


sudo apt-get install parted


you could also do a


sudo parted -l


to find out the file system of all block devices.

Subversion Update Broken in 1.5

Of recent I have noticed that the good old


svn up dir_name


does not seem to work as it used to. I have had heaps of missing files which were quite visible in the repository on closer examination! After having a dig around the man pages, I came up with the following


svn up -r HEAD --depth infinity dir_name


which achieves what I want. Quite strange. A quick peek at the documentation for Subversion 1.5 states that --depth infinity is default for sparse checkouts. I don't know what changed. Have a go at the code above if you've come across similar problems.

Tuesday, August 4, 2009

Running Webstart on Linux

A few people, (myself included) were confused about how to run web start files, specially through the browser.

When firefox prompts you for running jnlp files simply point it to your java_installation_dir/bin/javaws executable. :) It's that easy! :)

On the command line run:


javaws jnlp_url

eg.

javaws http://java.sun.com/docs/books/tutorialJWS/uiswing/components/ex6//TreeDemo.jnlp


You can test it out here.

Java6 plugginess

Installing a java plugin for Firefox has eluded me for a while. I had a look @ the usual posts but they seemed quite cumbersome. Imagine my surprise when I installed the firefox java plugin in a few easy steps!

1. Install Java6 SE or JRE from here.
2. Find your firefox installation. Mine was in /usr/lib/firefox-3.0.12

If you want to find out where your installation is, type:

grep 'LIBDIR' /usr/bin/firefox


You should see something like:


LIBDIR=/usr/lib/firefox-3.0.12

The LIBDIR variable has the location of the firefox installation.

3. Find the location of libnpjp2.so in your java installation.

Mine was in jdk_install_dir/jre/lib/amd64/libnpjp2.so

4. Change to the /usr/lib/firefox-3.0.12/plugins directory.


cd /usr/lib/firefox-3.0.12/plugins


5. Create a symlink to your libnpjp2.so file.


ln -s jdk_install_dir/jre/lib/amd64/libnpjp2.so libnpjp2.so


Your plugins directory will now have a symlink named libnpjp2.so

6. Open firefox and type:

about:plugins

You should see something like the following:


Java(TM) Plug-in 1.6.0_14

File name: libnpjp2.so
The next generation Java plug-in for Mozilla browsers.



You can further test your java installation at the following sites:

Java Tester
Java Verification
Dancing Duke

That's it! :)

References: 1 and 2.