$PATH in Solaris

February 7, 2006

It's always the little things about new Unix systems that get to me. Take $PATH on Solaris.

On a modern Linux distribution with a stock install, a sysadmin's full $PATH needs only five directories:

/bin /usr/bin /sbin /usr/sbin /usr/X11R6/bin

(Sometimes /usr/bin/X11 is used instead of /usr/X11R6/bin.)

On Solaris 9, my $PATH is (so far):

/usr/bin /bin /usr/sbin /sbin /usr/ccs/bin /opt/sfw/bin /usr/openwin/bin /usr/sfw/bin

Why are all of these necessary? Well,

  • /usr/ccs/bin is where Solaris hides make (and m4).
  • /usr/openwin/bin is where all the X programs live.
  • /usr/sfw/bin has wget.
  • /opt/sfw/bin has all the useful freeware programs, like rsync, python, lynx, and a diff that understands -u.

If I want to do anything with Sun's dt* tools, I need to add /usr/dt/bin. If I fiddled much with Java, I'd want to add /usr/java/bin.

Personally, I think that this is the sign of immature package management tools in Solaris 9. Not needing a pile of entries in $PATH is much easier for users, and decent package management tools make it no more difficult for the system administrator to manage.

Comments on this page:

From at 2006-02-07 10:06:34:

If you want an ever longer $PATH, you could add /usr/proc/bin for those handy p* commands. And then there's /usr/ucb, which you might want to add at the beginning of your $PATH if you prefer BSD commands to their System V equivalents. You can probably drop /bin, though, as it's usually just a symlink to /usr/bin on Solaris machines.

The Solaris kernel is an excellent piece of engineering, but the userland is pretty ugly. Now that OpenSolaris has made the kernel available, it's nice to see people rolling their own distributions based on Debian and other nice Linux userlands but using the Solaris kernel.




By cks at 2006-02-07 23:52:17:

Now this is interesting. It looks like the basic user path on Solaris 9 is '/usr/bin:' (nngh, the current directory is included), and the basic root path is '/usr/sbin:/usr/bin'. (Both based on what 'su - ...' results in.)

However, the Solaris 9 version of sshd seems to set a default path of '/usr/bin /bin /usr/sbin /sbin', which is where I got them from (I looked at my $PATH from a ssh login and my .profile just augments the existing $PATH).

I suspect that the sshd settings are a default that the Solaris team didn't notice (or didn't bother to change) when they turned OpenSSH into Sun_SSH_1.0.1 (to quote the port banner).

Written on 07 February 2006.
« The sysadmin's life
The id attribute considered dangerous »

Page tools: View Source, View Normal, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Tue Feb 7 01:47:15 2006
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.