Port 2222 - Coded in sshd_config

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
cjpete8
Posts: 13
Joined: Thu Aug 08, 2013 10:11 am

Port 2222 - Coded in sshd_config

Post by cjpete8 »

In the sshd_config file I have port 2222 coded. Is there a way to code the port so that it is the default port so I do not have to specifiy it when issuing the sftp command? For example: I enter sftp -oPort=2222 userid@dnsname. I would like to configure it so I can enter sftp userid@dnsname.
cjpete8
Posts: 13
Joined: Thu Aug 08, 2013 10:11 am

Re: Port 2222 - Coded in sshd_config

Post by cjpete8 »

I have had my questioned asked by one of my co-workers. We will be adding the port into the client.rc file. For example, adding: COZSFTP_CLIENT_OPTS="-o port=2222"
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Port 2222 - Coded in sshd_config

Post by dovetail »

Yes, but adding COZSFTP_CLIENT_OPTS="-oPort=2222" to cozsftp_client.rc would set that for all invocations (connecting to all servers).
This may not be what you want.

Since this is actually an option to the IBM Ported Tools ssh command (the ssh client), you can also add it to /etc/ssh/ssh_config or $HOME/.ssh/ssh_config.
In these files, you might want to use the conditional Host keyword so as to only set the port to 2222 for some hosts, or maybe *.some.doman.

For example:

# /etc/ssh/ssh_config - the system-wide defaults for the ssh client)
...
# Connect to any server in the following domain OR subnet with port 2222 instead of 22
Host *.myco.com 192.168.?.?
Port 2222
Host *
...

See the IBM Ported Tools OpenSSH User's guide under ssh_config for details.
Post Reply