[cfarm-users] Install wget on cfarm{104,119,240) ?
Olly Betts
olly at survex.com
Thu Feb 20 01:53:48 CET 2025
On Thu, Feb 20, 2025 at 12:17:56AM +0100, Martin Guy via cfarm-users wrote:
> On 18/02/25 19:37, Bruno Haible wrote:
> > You are free to change you default PATH via .profile or .bashrc.
>
> Yes, but not for ssh running a command.
As you've noticed ssh will only create a login shell for interactive
use, not when given a command to run.
However you can get .profile to be read by explicitly creating a login
shell:
$ ssh cfarm119.cfarm.net 'bash -c "env|grep ^PATH="'
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java8_64/jre/bin:/usr/java8_64/bin
$ ssh cfarm119.cfarm.net 'bash -l -c "env|grep ^PATH="'
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/olly/bin:/usr/bin/X11:/sbin:.
The second PATH value comes from my .profile on that host (which I think
must just be the default one for a newly created user as I wouldn't put
. in PATH by choice).
So you could customise PATH in this way, though properly quoting the
command becomes significantly harder. Putting anything complex in a
helper script and scp-ing it to the host would be one way around that.
(If you use such a helper script you could have the helper script
source ~/.profile if it exists and avoid needing "bash -l".)
Cheers,
Olly
More information about the cfarm-users
mailing list