Subject: Re: overriding standard executables via pkgsrc
To: Steven M. Bellovin <smb@cs.columbia.edu>
From: Charles Swiger <cswiger@mac.com>
List: netbsd-users
Date: 06/07/2005 14:31:05
On Jun 7, 2005, at 9:52 AM, Steven M. Bellovin wrote:
> I'm curious what people regard as the best way to override standard
> system executables with local versions or versions from pkgsrc.

List /usr/pkg/bin earlier in your $PATH.  As you mention later, it's  
probably not a good idea to delete or replace standard executables  
in /usr/bin (et al).

> Just installing things in /usr/pkg/bin or /usr/local/bin runs afoul of
> the default PATH -- those follow /bin and /usr/bin.  Change the  
> default
> path in login.conf?  Is that the only place $PATH is set from?  Change
> things in per-user .profile?  That isn't executed during ssh, I  
> believe.

Yes and no.  If you invoke "ssh _machine_ command", you will need to  
specify the command with a full path, otherwise SSH is going to look  
for the command using the path compiled into SSH.

However, if you invoke just "ssh _machine_" to get an interactive  
shell, SSH ought to give you a "login shell" which sets up the full  
environment and would read a ~/.profile.  You can double-check this  
by taking a look at "ps aux" or equivalent, and see whether your  
shell was a login shell by seeing whether there is a "-" in front of  
the command.

Try adding this to your .profile:

PATH=/usr/pkg/bin:$PATH

...and compare what you get from "echo $PATH" when you ssh to a  
machine via:

     ssh _machine_              ...versus...
     ssh _machine_ /bin/sh

-- 
-Chuck