LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   how to use different port for sftp? (https://www.linuxquestions.org/questions/linux-security-4/how-to-use-different-port-for-sftp-345359/)

cefs99 07-21-2005 09:25 AM

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

druuna 07-21-2005 09:48 AM

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.

cefs99 07-22-2005 03:16 AM

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

Linux~Powered 07-22-2005 07:04 AM

Try...

Code:

sftp -oPort=2222 user@123.456.789.012:/home/something
Note: The -oPort=???? has to be before the user@123......

cefs99 07-22-2005 08:15 AM

Thank you so much, it works perfectly!

corepuncher 11-13-2012 09:08 PM

Quote:

Originally Posted by cefs99 (Post 1759894)
thank you so much, it works perfectly!

yes thank you works great! :-)


All times are GMT -5. The time now is 12:21 AM.