Re: use alternate port with SFTP
Max Barel <[email protected]> Fri, 26 Mar 2010 00:23:50 +0100
| Newsgroups | gmane.comp.web.sitecopy |
|---|---|
| Message-ID | <[email protected]> |
Hi, I eventually managed to patch the sftpdriver.c file in order to use the spe= cified port of .sitecopyrc Here are the diffs: [max 00:14 sitecopy-0.16.6]$ diff src/sftpdriver.c* 87,89d86 < int port =3D sess->site->server.port; < char buf_port[16]; < sprintf(buf_port, "-oPort=3D%d", (port !=3D NULL ? port : 22)); 99,101c96,98 < execlp(sess->sftp_cmd, sess->sftp_cmd, buf_port, sess->buf, NULL); < NE_DEBUG(DEBUG_SFTP, "sftp exec: %s %s %s: %s\n", < sess->sftp_cmd, buf_port, sess->buf, strerror(errno)); --- > execlp(sess->sftp_cmd, sess->sftp_cmd, sess->buf, NULL); > NE_DEBUG(DEBUG_SFTP, "sftp exec: %s %s: %s\n", > sess->sftp_cmd, sess->buf, strerror(errno)); 146d142 < write(sess->fd_out, "\n", 1); The last line diff is not related to the port option but was necessary or e= lse the main process hang on reading the socket for the prompt. I will not try to add it to the repository. I rather prefer that someone qu= alified will review the diffs and do it. Anyhow it is now in this list for the next googler. Max Barel Le 15 mars 2010 =E0 19:31, Neil Cherry a =E9crit : > On 03/10/2010 02:12 PM, Max Barel wrote: >> Hi list, >> While searching for the question in title, I found this old reply from N= obuyuki Tsuchimura: >> = >>> Try rcp "sftp -oPort=3D21" = >>> in .sitecopyrc. "password" and "port" directives are ignored. >> = >> I tried it but it doesn't works maybe because it must not be used with "= protocol sftp". >> Can someone tell if it's possible at all to use sftp on alternate port (= !=3D22) >> = > = > Yes, it's possible but it will require a rewrite of the sftpdriver.c > init() function such that you can pass the port number to sftp > (change the line from sftp to sftp -o port %s for example). > = > -- = > Linux Home Automation Neil Cherry [email protected] > http://www.linuxha.com/ Main site > http://linuxha.blogspot.com/ My HA Blog > Author of: Linux Smart Homes For Dummies