# Rake SshFilePublisher on port different from standard 22

**URL:** <https://www.ruby-forum.com/t/rake-sshfilepublisher-on-port-different-from-standard-22/138963>\
**Category:** Rails\
**Created:** [May 29, 2008, 2:23pm UTC](https://www.ruby-forum.com/t/rake-sshfilepublisher-on-port-different-from-standard-22/138963 "2008-05-29T14:23:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [May 29, 2008, 2:23pm UTC](https://www.ruby-forum.com/t/rake-sshfilepublisher-on-port-different-from-standard-22/138963/1 "2008-05-29T14:23:46Z")

</div>

I am testing rake file upload, running well rcp in a terminal

scp -v -P 666 -q /Users/kadoudal/musicians.xml  
removed\_email\_address@domain.invalid:httpdocs/var/www/html/jazz\_people

but when running from the rake file

publisher = Rake::SshFilePublisher.new(  
“kadoudal@ [mydomain.com](http://mydomain.com)”,  
“/httpdocs/var/www/html/jazz\_people”,  
File.dirname( **FILE** ),  
t.prerequisites.first)  
publisher.upload

I get an error, which quite normal as I should precise the port 666

how can I do it ? there is no publisher.option ?

thanks for your help

note : I also tried “kadoudal@ [mydomain.com:666](http://mydomain.com:666)” as a host … no way  
error  
Command failed with status (1): [scp -q …

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [May 29, 2008, 3:12pm UTC](https://www.ruby-forum.com/t/rake-sshfilepublisher-on-port-different-from-standard-22/138963/2 "2008-05-29T15:12:21Z")

</div>

Kad K. wrote:

> I am testing rake file upload, running well rcp in a terminal
> 
> scp -v -P 666 -q /Users/kadoudal/musicians.xml  
> removed\_email\_address@domain.invalid:httpdocs/var/www/html/jazz\_people
> 
> but when running from the rake file
> 
> publisher = Rake::SshFilePublisher.new(  
> “kadoudal@ [mydomain.com](http://mydomain.com)”,  
> “/httpdocs/var/www/html/jazz\_people”,  
> File.dirname( **FILE** ),  
> t.prerequisites.first)  
> publisher.upload
> 
> I get an error, which quite normal as I should precise the port 666
> 
> how can I do it ? there is no publisher.option ?
> 
> thanks for your help
> 
> note : I also tried “kadoudal@ [mydomain.com:666](http://mydomain.com:666)” as a host … no way  
> error  
> Command failed with status (1): [scp -q …

ok solved with a patch in gem rake/contrib/sshpublisher.rb

```
# Upload the local directory to the remote directory on non-standard 

```

port  
def upload\_port(port=22)  
@files.each do |fn|  
sh %{scp -P #{port} -q #{@local\_dir}/#{fn}  
#{@host}:#{@remote\_dir}}  
end  
end

now I can do publisher.upload\_port(666)

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [May 29, 2008, 4:21pm UTC](https://www.ruby-forum.com/t/rake-sshfilepublisher-on-port-different-from-standard-22/138963/3 "2008-05-29T16:21:08Z")

</div>

On Thu, May 29, 2008 at 6:12 AM, Kad K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > I get an error, which quite normal as I should precise the port 666
> > 
> > how can I do it ? there is no publisher.option ?

You can also specify the port to use for a specific host in your own  
~/.ssh/config file – man ssh\_config

## FWIW,

Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [May 29, 2008, 5:37pm UTC](https://www.ruby-forum.com/t/rake-sshfilepublisher-on-port-different-from-standard-22/138963/4 "2008-05-29T17:37:17Z")

</div>

Hassan S. wrote:

> On Thu, May 29, 2008 at 6:12 AM, Kad K.  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > > I get an error, which quite normal as I should precise the port 666
> > > 
> > > how can I do it ? there is no publisher.option ?
> 
> You can also specify the port to use for a specific host in your own  
> ~/.ssh/config file – man ssh\_config
> 
> ## FWIW,
> 
> Hassan S. ------------------------ removed\_email\_address@domain.invalid

yes, ok thank you I belive that’s the reason why it was not necessary it  
include it as an option  
got it… (it was my first test of it…)
