If port is not set in PORTAGE_BINHOST="sftp://...", emerge will use port 22, please change it to respect /etc/ssh/ssh_config and not force port 22 by default.
i can reproduce this. 1. When ssh:// used for binhost, and PORTAGE_SSH_OPTS set to "-p ${portnumber}" it works. 2. When sftp:// used for binhost, and PORTAGE_SSH_OPTS set to "-P $portnumber}" it still trying to use port 22 instead. oleg oleg # emerge -gav htop ssh: connect to host ....org port 22: Connection refused Couldn't read packet: Connection reset by peer Fetcher exited with a failure condition. !!! Error fetching binhost package info from 'sftp://.../var/src/packages' !!! FETCHCOMMAND_SFTP failed
here is details which may enlighten things: https://bugs.funtoo.org/browse/FL-3200 apparently FETCHCOMMAND_SFTP have port hardcode to 22, which is always used as first argument for sftp, which makes it ignore any other custom defined ports.
(In reply to Nikoli from comment #0) > If port is not set in PORTAGE_BINHOST="sftp://...", emerge will use port 22, > please change it to respect /etc/ssh/ssh_config and not force port 22 by > default. If you specify PORTAGE_BINHOST="sftp://host:port/..." then it will respect the port that you have defined in PORTAGE_BINHOST. I have a patch to make it respect ssh_config in the following branch: https://github.com/zmedico/portage/tree/bug_499198
this patch fixes. ports now respected, when set in PORTAGE_SSH_OPTS. in ssh and sftp.
(In reply to Oleg from comment #4) > this patch fixes. ports now respected, when set in PORTAGE_SSH_OPTS. in ssh > and sftp. Great, thanks for testing. This is in the master branch: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a810a92d615c904db59326188e1437fdab74e705
Fixed in 2.3.0.