Doreen Boyle
asked on
SFTP won't use port 22
We use SFTP on our AS400 to Send data to a client on port 10022 (was set up a long time ago), and it works perfectly. We have a new client who wants us to SFTP using port 22, which is the default port. When we try to SFTP it tries to use port 10022. I looked and the SSH config file shows port 22. Why is SFTP getting port 10022 from, and more importantly how do we change it to use port 22 for this client?
OpenSSH_6.9p1, OpenSSL 1.0.2j 26 Sep 2016
debug1: Reading configuration data /QOpenSys/QIBM/ProdData/SC 1/OpenSSH/ etc/ssh_co nfig
debug2: ssh_connect: needpriv 0
debug1: Connecting to eft-dev.safeliteABC.com [xxx.xxx.xxx.xxx] port 10022.
debug1: connect to address xxx.xxx.xxx.xxx port 10022: Connection refused
ssh: connect to host eft-dev.test.com port 10022: Connection refused
Connection closed
OpenSSH_6.9p1, OpenSSL 1.0.2j 26 Sep 2016
debug1: Reading configuration data /QOpenSys/QIBM/ProdData/SC
debug2: ssh_connect: needpriv 0
debug1: Connecting to eft-dev.safeliteABC.com [xxx.xxx.xxx.xxx] port 10022.
debug1: connect to address xxx.xxx.xxx.xxx port 10022: Connection refused
ssh: connect to host eft-dev.test.com port 10022: Connection refused
Connection closed
our system is running os400 v7r3. Not sure what you mean by other U-fix derivative. Interesting, I didn't realize there was more than one config. file.
Check to make sure you did not alias sftp as sftp -p 10022
Or check where sftp command is /usr/bin/sftp and see if you can connect.
If both, make sure that sftp is not a shell script that then uses sftp.orig -p 10022
-p 22 should work to tell sftp to use an alternate port, 22 in your case, potentially when the OpenSSH was built port 10022 was set as the default port...
Or check where sftp command is /usr/bin/sftp and see if you can connect.
If both, make sure that sftp is not a shell script that then uses sftp.orig -p 10022
-p 22 should work to tell sftp to use an alternate port, 22 in your case, potentially when the OpenSSH was built port 10022 was set as the default port...
Check the config read in in your output,
/QOpenSys/QIBM/ProdData/SC 1/OpenSSH/ etc/ssh_co nfig
Make sure this is not where the default port is set to 10022, there is no need to alter it, just use the -p option to specify the port to use when it is different from your default.
/QOpenSys/QIBM/ProdData/SC
Make sure this is not where the default port is set to 10022, there is no need to alter it, just use the -p option to specify the port to use when it is different from your default.
Hi Arnold - in the /QOpenSys/QIBM/ProdData/SC 1/OpenSSH/ etc/ssh_co nfig it shows the port as 22. I tried sftp -oport=22 initially, but that didn't work. I will try -P 22 and see if that works.
Was relying on the knowledge of ssh options, but you were on the right track
-oPort=22
Should work
Snippet from sftp man page:
Make sure the sftp you are running is not aliased, or uses a wrapper script of sorts.
-oPort=22
Should work
Snippet from sftp man page:
o ssh_option
Can be used to pass options to ssh in the format used
in ssh_config(5). This is useful for specifying
options for which there is no separate sftp command-
line flag. For example, to specify an alternate port
use: sftp -oPort=24.
Make sure the sftp you are running is not aliased, or uses a wrapper script of sorts.
Arnold - turns out oport 22 did work - just needed to have the command in the correct sequence! Thanks for your help, It's greatly appreciated.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Open in new window
This may take a good long while, but it should reveal which config file has the port number in it. It'll probably also drag up a lot of other things in binaries, but those should be obviously not what you want.