πŸ‡―πŸ‡΅ ζ—₯本θͺž | πŸ‡ΊπŸ‡Έ English | πŸ‡ͺπŸ‡Έ EspaΓ±ol | πŸ‡΅πŸ‡Ή PortuguΓͺs | πŸ‡ΉπŸ‡­ ΰΉ„ΰΈ—ΰΈ’ | πŸ‡¨πŸ‡³ δΈ­ζ–‡

Can't Connect with WinSCP! A Complete Guide to Causes and Solutions for Beginners

WinSCP is an essential tool for website creation and server management. It's incredibly convenient for uploading and downloading files to and from a server, right? But have you ever tried to use it, only to find that "for some reason, I can't connect..."?

Even when an error message appears, it's full of technical jargon you don't understand, and it's easy to feel your mind go blank...😱

In this article, aimed at beginner web creators, we will thoroughly explain the main causes of connection failures in WinSCP and their solutions, using diagrams and specific examples. By reading this article, you'll be able to calmly and coolly resolve troubles without panicking!


First, the Basics! Double-Check Your Connection Information

"Silly mistakes" happen to everyone. Before you start thinking about complex causes, let's first check if the most basic connection information is correct. Surprisingly, this is often the cause of the problem.

WinSCP's login settings screen

Let's take another close look at this screen when you start WinSCP.

βœ… Checkpoint: When you copy and paste, make sure there are no extra spaces before or after the text. This alone can cause an authentication error.


Common Error Messages, Causes, and Solutions

If you can't connect even after checking the basic information, the error message that appears will be a big hint. Here, let's look at the causes and solutions for each representative error message.

1. "Network error: Connection timed out"

This means that WinSCP tried to contact the server, but it didn't get a response within a certain amount of time.

WinSCP timeout error

πŸ€” Possible Causes

πŸš€ Solutions

  1. First, go back to the "Basics" section above and double-check the host name and port number.
  2. If you're using a rental server, check the control panel for settings like "IP Address Restriction" or "Overseas IP Address Restriction." If this is set and your IP address is not on the allow list, you'll need to add it.
  3. Try temporarily disabling your PC's security software and attempting to connect. If you can connect this way, you'll need to configure your security software to allow WinSCP's communication.
  4. If you've checked all of the above and it still doesn't work, there may be a problem with the server itself. Try contacting your server administrator.

2. "Host '...' does not exist"

This is a relatively straightforward error, meaning "the host name (server address) you entered could not be found."

πŸ€” Possible Causes

πŸš€ Solutions

  1. Thoroughly check the host name you entered. The most reliable way is to copy and paste the information from the email sent by your server provider or from the admin panel, without changing a single character.
  2. If you've just acquired a domain (e.g., `example.com`), it can take some time for the DNS information to propagate across the internet (from a few hours to a maximum of 72 hours). Try again after a little while.

3. "Access denied" / "Authentication failed"

You've managed to reach the server, but you're being turned away at the door with a "Who are you? I can't let you in." It's highly likely that there's a problem with your authentication credentials (ID, password, or key).

WinSCP authentication failure error

πŸ€” Possible Causes

πŸš€ Solutions

  1. Re-check your username and password:
    • Case matters. `Password` and `password` are two different things.
    • Check that you haven't mixed up the number `0` with the letter `O`, or the number `1` with the letter `l`.
    • As mentioned before, it's a good idea to type it in a notepad and then copy and paste.
  2. Checkpoints for key authentication (SFTP):

    Key authentication is a method of authenticating using a pair of files called a "private key" and a "public key" instead of a password. It's recommended as a more secure connection method.

    1. On the WinSCP login screen, click the "Advanced..." button, then select "SSH" > "Authentication" from the left menu.
    2. In the "Private key file" field, check that the correct `.ppk` file is specified. `.ppk` is the private key file format used by WinSCP and PuTTY.
    3. You need to check that the corresponding public key is correctly installed on the server. Usually, you write the contents of the public key to a file named /home/username/.ssh/authorized_keys on the server. If you're unsure about this process, ask your server administrator to check.
    4. If you've set a passphrase (a password to unlock the key) for your private key, you'll be prompted to enter it. Be careful of typos, just like with a password.

4. "Server refused our key"

This is an error specific to using key authentication. It means the server is rejecting the private key that WinSCP presented, saying, "I don't know this key."

πŸ€” Possible Causes

πŸš€ Solutions

If you can log in to the server via SSH, you can check the settings with the following commands. If you can't log in via SSH or are unsure about command-line operations, it's smoother to ask your server administrator, "I'm getting a key authentication error with WinSCP. Could you please check the settings and permissions for `authorized_keys`?"

[For Requesting Confirmation] Command to check permissions of authorized_keys
This command is run on the server. Sharing the result of this command with the administrator can speed up problem identification.

ls -la ~/.ssh/authorized_keys

The correct permission is `600` (-rw-------). This means only the owner can read and write. If it's set to anything else (like `644`), the server won't read the key for security reasons.

[For Requesting Confirmation] Command to check permissions of the .ssh directory

ls -ld ~/.ssh

The permission for the `.ssh` directory itself needs to be `700` (drwx------). You can use the following commands to reset them, but if you're not confident in your skills, always ask your administrator to do it.

[For Changing Settings] Permission change commands (for advanced users)

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Still Can't Solve It? The Last Resort: The "Logging" Feature

If you've tried all the methods introduced so far and still can't connect, WinSCP's "Logging" feature is your last hope.

When you enable logging, WinSCP records in detail what kind of communication it attempted with the server and at what stage it failed. Looking at this log file can provide experts and server administrators with very powerful clues to identify the cause.

  1. Click the "Advanced..." button on the login screen.
  2. Check the "Advanced options" box at the bottom left of the window that opens.
  3. An item called "Logging" will appear in the left-hand menu; click it.
  4. In the "Log file" field, enter the destination and file name for the log output (e.g., `C:\Users\YourUser\Desktop\winscp.log`). It's easy to choose a location using the "..." button.
  5. Set the "Log level" to "Normal" or "Debug 2" to get more detailed information.
  6. Try to log in once with this setting. If it fails, a log file will be generated in the location you specified.

WinSCP's logging settings screen

The contents of the log file are technical, but if you look closely around the error message, you should find keywords you've seen before, like "Access denied" or "Connection failed". Providing this log file to your server administrator will speed up the problem-solving process considerably.


Summary

It's really frustrating when you can't connect with WinSCP and your work comes to a halt. However, most of the causes are due to basic configuration mistakes or environmental differences like the ones introduced here.

If you encounter trouble, first refer to this article and calmly check the following steps:

  1. Re-check basic information: Host name, protocol, port number, user name, password.
  2. Check the error message: Is it a timeout, host not found, or authentication failure?
  3. Check key authentication (for SFTP): Is the private/public key pair correct? Are the permissions correct?
  4. Get the logs: If you really can't solve it, get a detailed log and consult an expert or administrator.

If you check each one carefully, you'll definitely find a clue to the solution. Good luck! πŸš€