how to use different port for sftp?
Hi guys,
I am wondering how to tell sftp to use port other than 22 to connect other ssh server? seems simply sftp 1.1.1.1 -oPort=2222 as `man sftp` said doesnt work anyone had experience? Tks, Hong |
Hi,
You need to set up the ssh daemon to listen to the port(s) you want to connect on. This also implies the need to ssh and scp on that port...... In your sshd_config these 2 take care of this: - ListenAddress - Port If port is used, all addresses (ip numbers) listen on that port. Setting specific ports on specific ip's/adresses is possible too: Do not set the port value (remove it) and do something like this: ListenAddress 200.01.01.01:32 ListenAddress 192.168.1.1:22 The outside (fake ip 200.01.01.01) world needs to use port 32, the local network (192.168.1.1) can use the default port (22). See man sshd en sshd_config for details. Hope this helps. |
Tks, but I think I failed to describe my problem clearly.
I know how to set sshd to listen at different port other than 22. but after I set my sshd to listen at, say, 2222 port. I need to know how to use sftp connect to this server from another linux box in command line. I know how to connect via ssh: ssh 1.1.1.1 -p 2222 but how to use sftp? man sftp said used -oPort=2222 but doesnt work. sftp still said failed to connect to port 22 any idea? tks, Hong |
Try...
Code:
sftp -oPort=2222 user@123.456.789.012:/home/something |
Thank you so much, it works perfectly!
|
Quote:
|
All times are GMT -5. The time now is 12:21 AM. |