1

I have a Ubuntu 10.10 server running in VirtualBox with OpenSSH installed. I have forwarded port 8888 on the host to 80 on the guest, and 2222 on the host to 22 on the guest. For some reason, I can SSH into this server using localhost:2222 just fine, but when I try to SFTP in with WinSCP also at localhost:2222 I get a "connection refused" error. This is my sshd_config file, if that helps:

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile     %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

Update: Out of curiosity, I installed FileZilla and tried connecting with that. It worked perfectly fine. Apparently the problem is on WinSCP's end, not the server. I'll look into it some more.

2
  • On the Ubuntu server can you do sftp localhost? Apr 5, 2011 at 18:55
  • Yeah, that works perfectly fine. I tried starting from scratch with a TurnKey linux OVF file, thinking that'd work out of the box, but WinSCP still isn't connecting.
    – Omega192
    Apr 6, 2011 at 2:42

7 Answers 7

1

I don't think sftp lets you tack :port to the end of a hostname. You might try

sftp -o Port=2222 localhost

instead

3
  • Indeed the :port syntax actually refers to a file or directory for sftp. Also, "sftp -P 2222 localhost" would be easier than the long options with -o. Apr 5, 2011 at 0:07
  • Oop, perhaps I didn't make it clear enough. I'm using WinSCP, so there's no sytax really. Just entering "localhost" into hostname, and 2222 for port.
    – Omega192
    Apr 5, 2011 at 5:39
  • @Bostonvaulter On Linux & OS X the sftp man page says "-P sftp_server_path". On the systems I've checked here you have to use "-o Port=...". Apr 5, 2011 at 15:43
1

Hmm, I'm not sure how to go about this, so I guess I'll answer my own question. I posted an update to the question, but it appears that people missed it.

Out of curiosity, I installed FileZilla and tried connecting with that. It worked perfectly fine. Apparently the problem is on WinSCP's end, not the server.

1
1

The following works for me: psftp.exe localhost -P 2222 this is assuming port forwarding is guest 2222 for host 22

0

Why do you try connecting with SFTP? Do you have a running FTP-Server? I assume not because you didn't mention it.

Try SCP instead. That should work. Your problem may be related to active/passive FTP modes.

3
  • SFTP != FTPS.
    – EEAA
    Apr 4, 2011 at 22:07
  • Yargs.. Should go to bed.. Thanks for correcting me.
    – Chris
    Apr 4, 2011 at 22:08
  • Haha, common mistake, it's alright. Thanks anyway!
    – Omega192
    Apr 4, 2011 at 22:32
0

Check your IPS/IPS for blocking openssh-challenge-response-bo.

1
  • Did you note that connection works with FileZilla? Nov 23, 2012 at 11:33
0

SSHD has a FTP built-in protocol via SFTP that doesn't require a FTP server be running on the server machine. A SCP client or maybe Bitvise Tunnelier should get you connected to transfer files.

0

Some SFTP/SCP clients get very confused if the shell they use on the remote side belches banner messages at them on login, especially if there are terminal escapes etc involved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .