AdSense Mobile Ad

Thursday, July 9, 2009

Setting up the right umask when installing NetBeans

This isn't a problem I encounter so often when installing software on the Solaris platform. The strange thing is that NetBeans is a Sun-sponsored project! But hey, a bug's just a bug.

Solaris default umask (file mode creation mask) for user is 022. That means that during file creation the write bit is filtered away from group and other permission bits. So, if you touch a file, you'll end up with these permissions set:
$ touch test
$ ls -l test
-rw-r--r--   1 enrico   staff          0 Jul  9 23:45 test
This basically means that everybody is granted access for reading your file. That may not be an issue for you because that file is hanging from a directory hierarchy which is otherwise protected. Solaris though, if the umask is not changed when creating home directories, will create a home directory for you with world readable flags set.

To cope with such situations, a good practice could be changing the default umask to a more restrictive value, such as 077. That's the umask I use and, as you see, it filters away all the permission bits for group and others. The previous test will end up with such a result:
$ touch test2
$ ls -l test2
-rw-------   1 enrico   staff          0 Jul  9 23:49 test2
This is not a problem unless the software you're using relies on a particular umask values (such as 022). That appears to be the case for the NetBeans installer. I just installed NetBeans 6.7, replacing my "venerable" NetBeans 6.5, and I ended up with the same problem I encountered during the installation of the earlier version. If you install NetBeans with a more restrictive umask set, the installation will result in an unusable set of files.

So, remember: if you're planning to install NetBeans 6.x onto your Solaris box and you plan to install it as root to provide an installation for all of your users, don't miss (re-)setting your umask to 022:
# umask 022
# ./

No comments: