Archived Forum Post

Index of archived forum posts

Question:

Do Sftp requires to give Port Number

Sep 12 '14 at 09:47

I am migrating vb.net code which is already connected in ftp folder path to sftp using chilkat dll.

In Chilkat.sftp, they are explicitly mentioned about Port Number.

At present, i am using the mentioned Standard SSH Port # 22. It works.

My question, do i need to mention the Port Number. And whether the Port Number has to be 22 ??

  '  Connect to the SSH server.
    '  The standard SSH port = 22
    '  The hostname may be a hostname or IP address.
    Dim port As Long
    Dim hostname As String
    hostname = "www.my-ssh-server.com"
    port = 22
    success = sftp.Connect(hostname,port)
    If (success <> true) Then
        MsgBox(sftp.LastErrorText)
        Exit Sub
    End If

Accepted Answer

Servers listen at well known port numbers. For example, FTP servers listen at port 21 or port 990 for SSL/TLS. SMTP servers listen at port 25, 587, or 465. HTTP servers listen at port 80 or 443. SSH servers typically listen at port 22. There is no "SSL" port for SSH because the SSH transport itself is an encrypted channel. Unless the SSH server is explicitly configured to listen at a non-standard port, it should be listening at port 22.

Yes, you must pass 22 for the port.