I need to run SCP, SFTP, and SSH in the same host but via three different ports; is there a way where we can configure SSHD in that manner? Thanks in advance.
Asked
Active
Viewed 5,265 times
3 Answers
1
You can do that by adding in
/etc/ssh/sshd_config
file the ports you want to use on the server: Example:
Port 22
Port 60000
Port 60001
And then on the client you can, for example:
$ scp -p 60000 ./file 192.168.1.2:/home/user/ ##adapt on your needs
in another terminal
$ ssh user@192.168.1.2 ##that's on port 22
and can run sftp
$ sftp -P 60001 user@192.168.1.2:/home/user/file #transfer file to your pwd
That it.
C. La Mosca
- 91
0
The port that has full usual SSH on it will always also be usable for scp and SFTP. If that restriction is fine for you, you can of course start two additional SSH servers by passing other config files with other Port settings via -f. One of them will have the ForceCommand internal-sftp setting, the other one any of the solutions suggested here.
jplitza
- 329
0
As a variant, you could configure SSH on any port that you want and make port-forwarding from three(for SSH, SCP and SFTP) different ports to this SSH port.
Alexander Tolkachev
- 4,666