# SSH, Capistrano, PATH, Mac OS X

**URL:** <https://www.ruby-forum.com/t/ssh-capistrano-path-mac-os-x/66831>\
**Category:** Rails\
**Created:** [August 29, 2006, 5:43pm UTC](https://www.ruby-forum.com/t/ssh-capistrano-path-mac-os-x/66831 "2006-08-29T17:43:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aiwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e79b87/32.png) [@aiwilliams](https://www.ruby-forum.com/u/aiwilliams)\
**Post date:** [August 29, 2006, 5:43pm UTC](https://www.ruby-forum.com/t/ssh-capistrano-path-mac-os-x/66831/1 "2006-08-29T17:43:40Z")

</div>

Gentlefolk,

I need help. When I run my Capistrano script, none of svn, rake,  
mongrel\_rails are availble to the ssh process. When I login myself,  
using the username that Capistrano is using, it’s all there. I added an  
explicit PATH export to one of the tasks, which made that task work,  
but I can’t easily control update\_code, and I don’t want to.

I have modified my .bashrc, .bash\_profile, .profile… all to no  
avail. Even messed with .ssh/environment. I can ‘ssh themac.hostname  
svn -help’, no problem. Aaahh!!

Thank you,

aiwilliams

---

<div class="post-metadata">

**Author:** ![aiwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e79b87/32.png) [@aiwilliams](https://www.ruby-forum.com/u/aiwilliams)\
**Post date:** [August 29, 2006, 5:50pm UTC](https://www.ruby-forum.com/t/ssh-capistrano-path-mac-os-x/66831/2 "2006-08-29T17:50:19Z")

</div>

aiwilliams wrote:

> Gentlefolk,
> 
> I need help. When I run my Capistrano script, none of svn, rake,  
> mongrel\_rails are availble to the ssh process. When I login myself,  
> using the username that Capistrano is using, it’s all there. I added an  
> explicit PATH export to one of the tasks, which made that task work,  
> but I can’t easily control update\_code, and I don’t want to.
> 
> I have modified my .bashrc, .bash\_profile, .profile… all to no  
> avail. Even messed with .ssh/environment. I can ‘ssh themac.hostname  
> svn -help’, no problem. Aaahh!!
> 
> Thank you,
> 
> aiwilliams

What is the actual output you are getting?

---

<div class="post-metadata">

**Author:** ![aiwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e79b87/32.png) [@aiwilliams](https://www.ruby-forum.com/u/aiwilliams)\
**Post date:** [August 30, 2006, 2:59am UTC](https://www.ruby-forum.com/t/ssh-capistrano-path-mac-os-x/66831/3 "2006-08-30T02:59:11Z")

</div>

Any clues Ben? Anyone? Perhaps I need to make Capistrano allow  
configuration of server path? Hate that.

---

<div class="post-metadata">

**Author:** ![aiwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e79b87/32.png) [@aiwilliams](https://www.ruby-forum.com/u/aiwilliams)\
**Post date:** [August 30, 2006, 4:41am UTC](https://www.ruby-forum.com/t/ssh-capistrano-path-mac-os-x/66831/4 "2006-08-30T04:41:17Z")

</div>

I had this same problem :

[http://thread.gmane.org/gmane.comp.lang.ruby.rails/70978/focus=71376](http://thread.gmane.org/gmane.comp.lang.ruby.rails/70978/focus=71376)

I got it working after putting the PATH in the .ssh/environment file.

Hammed

---

<div class="post-metadata">

**Author:** ![aiwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e79b87/32.png) [@aiwilliams](https://www.ruby-forum.com/u/aiwilliams)\
**Post date:** [August 30, 2006, 5:29pm UTC](https://www.ruby-forum.com/t/ssh-capistrano-path-mac-os-x/66831/5 "2006-08-30T17:29:26Z")

</div>

Hammed M. wrote:

> I had this same problem :
> 
> [http://thread.gmane.org/gmane.comp.lang.ruby.rails/70978/focus=71376](http://thread.gmane.org/gmane.comp.lang.ruby.rails/70978/focus=71376)
> 
> I got it working after putting the PATH in the .ssh/environment file.

Thank you, Hammed. I had done that long ago, but it turns out that I  
lacked the knowledge of sshd that I needed. Not only do you need that  
~/.ssh/environment file, you will also want to ensure that  
/etc/sshd\_config has ‘PermitUserEnvironment’ set yes. Otherwise  
sshd will not read your ~/.ssh/environment settings.

Also of potential interest, I discovered that you can theoretically set  
options, like ‘environment=“PATH=/opt/local/bin”’ in the public key on  
the server, as documented when you man sshd. I tried that, but it did  
not seem to work. The man page seems to indicate that sshd determines  
the prescense of options by looking to see if the key line begins with  
a number, which it cannot with SSH Version 2 - it has [options]  
key-type base64.

Thanks again.

aiwilliams

---

<div class="post-metadata">

**Author:** ![aiwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e79b87/32.png) [@aiwilliams](https://www.ruby-forum.com/u/aiwilliams)\
**Post date:** [March 26, 2007, 8:13pm UTC](https://www.ruby-forum.com/t/ssh-capistrano-path-mac-os-x/66831/6 "2007-03-26T20:13:58Z")

</div>

Just so nobody else starts yelling obscenities:  
Make sure you edit sshd\_config, not ssh\_config.

---

<div class="post-metadata">

**Author:** ![aiwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e79b87/32.png) [@aiwilliams](https://www.ruby-forum.com/u/aiwilliams)\
**Post date:** [August 29, 2006, 6:27pm UTC](https://www.ruby-forum.com/t/ssh-capistrano-path-mac-os-x/66831/7 "2006-08-29T18:27:49Z")

</div>

Ben Marini wrote:

> What is the actual output you are getting?

adam-williams-computer:~/Documents/workspace/myapp aiwilliams$ rake  
remote:cold\_deploy  
(in /Users/aiwilliams/Documents/workspace/myapp)  
loading configuration  
/opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/recipes/standard.rb  
loading configuration ./config/deploy.rb  
loading configuration  
#Proc:0x00771a70@/opt/local/lib/ruby/gems/1.8/gems/mongrel\_cluster-0.2.0/lib/mongrel\_cluster/recipes.rb:1

- executing task cold\_deploy
- executing task deploy  
\*\* transaction: start
- executing task update\_code
- querying latest revision…
- executing “if [[ ! -d /var/www/apps/myapp/releases/20060829161326  
]]; then\n svn co -q -r1929 [http://repository/trunk](http://repository/trunk)  
/var/www/apps/myapp/releases/20060829161326 &&\n (test -e  
/var/www/apps/myapp/revisions.log || touch  
/var/www/apps/myapp/revisions.log && chmod 666  
/var/www/apps/myapp/revisions.log) && echo `date +\"%Y-%m-%d %H:%M:%S\"` $USER 1929 20060829161326 \>\>  
/var/www/apps/myapp/revisions.log;\n fi”  
servers: [“server.ws”]  
[server.ws] executing command  
\*\* [out :: server.ws] bash: line 2: svn: command not found  
command finished  
\*\*\* [update\_code] transaction: rollback
- [update\_code] rolling back
- executing “rm -rf /var/www/apps/myapp/releases/20060829161326”  
servers: [“server.ws”]  
[server.ws] executing command  
command finished  
rake aborted!  
command “if [[! -d /var/www/apps/myapp/releases/20060829161326]];  
then\\n svn co -q -r1929 [http://repository/trunk](http://repository/trunk)  
/var/www/apps/myapp/releases/20060829161326 &&\\n (test  
-e /var/www/apps/myapp/revisions.log || touch  
/var/www/apps/myapp/revisions.log && chmod 666  
/var/www/apps/myapp/revisions.log) && echo `date +\"%Y-%m-%d %H:%M:%S\"` $USER 1929 20060829161326 \>\>  
/var/www/apps/myapp/revisions.log;\\n fi” failed on  
server.ws

(See full trace by running task with --trace)  
adam-williams-computer:~/Documents/workspace/myapp aiwilliams$
