non-standard PATH

9 views
Skip to first unread message

redbaritone

unread,
Aug 2, 2007, 6:34:43 PM8/2/07
to Capistrano
On Aug 2, 5:16 pm, "Jamis Buck" <ja...@37signals.com> wrote:
> If you have non-standard paths that
> you want Capistrano to use, you need to set them via something like
> the default_environment hash:
>
> default_environment["PATH"] = "/path/one:/path/two:/path/three"

I changed the path in /etc/profile (which is run for ALL connecting
users, including the one that Capistrano is using). It still doesn't
work, but I'll move on. Where would I put the
default_environment["PATH"] = ... command? in deploy.rb?

Thanks.

Jamis Buck

unread,
Aug 2, 2007, 6:53:14 PM8/2/07
to capis...@googlegroups.com
Right, no profiles are loaded by Capistrano, by default, because it
does not execute commands in a login shell. If you want non-login
shells to use the profiles, you can set an sshd configuration
option...but you'll need to google for it, because I can't remember it
off the top of my head.

And yes, deploy.rb is where you set default_environment.

- Jamis

dusty

unread,
Aug 9, 2007, 1:22:40 PM8/9/07
to Capistrano
On Aug 2, 6:53 pm, "Jamis Buck" <ja...@37signals.com> wrote:
> Right, no profiles are loaded by Capistrano, by default, because it
> does not execute commands in a login shell. If you want non-login
> shells to use the profiles, you can set an sshd configuration
> option...but you'll need to google for it, because I can't remember it
> off the top of my head.
>
> And yes, deploy.rb is where you set default_environment.
>
> - Jamis
>
> On 8/2/07, redbaritone <DougHall...@gmail.com> wrote:
>

> > > If you have non-standard paths that
> > > you want Capistrano to use, you need to set them via something like
> > > the default_environment hash:
>
> > > default_environment["PATH"] = "/path/one:/path/two:/path/three"
>

> > I changed thepathin /etc/profile (which is run for ALL connecting


> > users, including the one that Capistrano is using). It still doesn't
> > work, but I'll move on. Where would I put the
> > default_environment["PATH"] = ... command? in deploy.rb?
>
> > Thanks.


I can't seem to get that default_environment["PATH"] setting to work.
Does it look just like that in a capfile?

default_environment["PATH"] = "/asdf:/asdf/asdf"


But, to your reply, I have found this to work. I would rather not
have to set this up on each machine though.

in sshd_config, change this line
#PermitUserEnvironment no
TO
PermitUserEnvironment yes

Then for the user you are logging into create a file .ssh/
environment. Make it only readable by that user and add your path.

# echo 'PATH="/bin:/usr/bin:/someotherpath"' > .ssh/environment
# chmod 600 .ssh/environment


Jamis Buck

unread,
Aug 9, 2007, 1:34:12 PM8/9/07
to capis...@googlegroups.com
Your default_environment setting looks right. How are you sure that it
isn't working? Try creating a simple task like this:

task :dump_env do
run "echo $PATH"
end

And see if the correct path is being set.

- Jamis

dusty

unread,
Aug 9, 2007, 2:37:16 PM8/9/07
to Capistrano
You're right, it is working. Not sure what I was doing wrong before
as I pulled that part out of my capfile. At least now I know what
that SSH setting is for, always wondered about that.

Thanks for encouraging me to check again! I like this method better.

:)

On Aug 9, 1:34 pm, "Jamis Buck" <ja...@37signals.com> wrote:
> Your default_environment setting looks right. How are you sure that it
> isn't working? Try creating a simple task like this:
>
> task :dump_env do
> run "echo $PATH"
> end
>

> And see if the correctpathis being set.
>
> - Jamis

Reply all
Reply to author
Forward
0 new messages