On this page
Quick answer. In WinSCP, select New Site, set File protocol to SFTP, enter the server’s host name, keep port 22 unless you were given another port, and enter the account name. Use Login, compare the SSH host-key fingerprint with a value from the administrator, and only then continue. Add a private key under Advanced, SSH, Authentication, when the server expects a key instead of a password.
What you need
- WinSCP installed from the official source, covered in the download guide.
- The hostname or IP address of a server you are allowed to use.
- A username on that server.
- A password or a private key in PuTTY
.ppkform. OpenSSH key files can be converted. WinSCP does not accept them until they are converted. - The host-key fingerprint, obtained from the administrator by a channel you already trust, such as a console, a ticket system, or a phone call. The fingerprint is not the password.
The examples below use placeholder names. Substitute your own. Do not send real host names, passwords, or keys to this website.
Connect to an SFTP server
-
Open the Login window
Start WinSCP. The Login dialog opens on a normal first run. If you already have a session open, use the command that opens a new session so the same dialog returns. In the tree on the left, select New Site. The right side shows an empty session rather than a saved one. If you edit a saved site by mistake, the title and the buttons change to editing, and Login stays unavailable until you Save or Cancel. Cancel if you did not mean to edit.
-
Configure the connection settings
Set each field for the server you were given. The fields do different jobs:
- File protocol. Choose SFTP. Choose FTP only when the host is an FTP or FTPS server, and then set encryption as described in the protocol guide. SCP is the legacy SSH copy protocol, not a synonym for SFTP.
- Host name. Type the DNS name or IP address of your server, such as the name in the hosting panel. This is the only field WinSCP requires before it will try to open a session. A session URL pasted here is parsed into the other fields. Do not paste a URL that contains a password.
- Port number. WinSCP fills in the usual port for the protocol. For SFTP that is 22. Change it when the administrator published a different port. A host that listens on 2222 will not answer on 22, and the usual port is not a requirement.
- User name. Type the account on the server. If you leave it blank, WinSCP asks later, except for a few special cases such as GSSAPI. For Amazon S3 this box is the access key ID, which is a different kind of login.
- Password. Type it only if this account uses password authentication and you are connecting immediately. If you will save the site, leave the password empty and enter it at login, or use a private key and leave the password empty. Saving a password requires an extra confirmation in the save dialog. Skip that confirmation on a computer other people can unlock.
Open Advanced only when you need a private key, a proxy, or a non-default encryption choice. A plain SFTP server with a password does not need any advanced page filled in.
-
Verify the server host key
Click Login. On the first connection to this SSH server, WinSCP stops and shows the host key fingerprint. SSH does this so a different computer cannot silently impersonate your server and collect the password. WinSCP has nothing stored yet, so it cannot know whether the fingerprint is the right one. You decide.
Compare the SHA-256 fingerprint on the screen with the fingerprint the administrator gave you. Read it character by character. Zero and the letter O, and one and the letter L, are easy to swap. If the administrator sent more than one fingerprint, the one on screen should be in that list. Algorithms differ. An Ed25519 fingerprint and an RSA fingerprint from the same server are both legitimate if both were given to you. A fingerprint that matches none of them is not.
Continue only when the values match. WinSCP then stores the key in its configuration and will warn you if a later connection presents a different key. If you have no fingerprint to compare, stop and ask the administrator. Connecting across the internet without that comparison means you are trusting the network path on faith.
The host key identifies the server. It is not the public key you place in
authorized_keys, and it is not your private key file. Mixing those up is the usual reason a key field “does nothing.” -
Establish the connection
After you accept a fingerprint you have checked, WinSCP authenticates. If the password or key is accepted, the main window opens and the remote panel lists a directory. That listing is the proof of a successful login. A prompt that returns to the password field means authentication failed. A message that never reaches authentication is a connection problem. Use the matching section:
- Connection refused
- Connection timed out
- Authentication failed and access denied
- Permission denied after the file list is already visible
-
Upload or download a test file
In the Commander interface the local panel is on the left and the remote panel is on the right by default. The address bar above each panel is the folder that will be used. Open the local folder that holds a small test file, and open the remote folder you are allowed to write. Drag the test file from the local panel into the remote panel. WinSCP asks for transfer options. Leave the mode on Automatic for an ordinary text or binary mix, or choose Binary for an archive or image. Confirm the copy.
The remote panel should show the new name when the transfer finishes. If a queue is running at the bottom, wait until that item finishes before you judge the result. The full transfer workflow, including resume and sync, is in the file transfer guide.
-
Verify the result
Check three things. The remote file name matches. The size matches the local file. Opening or downloading the file again produces the same size. If the size changed on a file that should have been copied byte for byte, you likely used text mode on a binary file. Transfer it again in binary mode to a new name, then delete the damaged copy only after the new one checks out.
Save the site and find it later
If you will use the server again, return to the Login dialog, select the session you just configured, and click Save. Give the site a name you will recognize, including the protocol if you also have an FTPS site on the same host. You can organize sites in folders with Manage, New folder. Double-clicking a saved site connects, which is the same as Login.
Manage, Delete removes the saved site. It does not delete files on the server. Manage, Rename changes the label. Manage, Clone to New Site starts a copy when two accounts differ only by username. Manage, Open in PuTTY opens a terminal on SSH sites. That is optional and requires PuTTY. It is not part of the file transfer.
To see the stored host key later, open the Server and protocol information dialog while connected. If a future login says the key changed, do not update the stored key until the administrator confirms the new fingerprint. A reinstalled server can have a new key. So can an attack. The two situations look the same from your chair.
Log in with an SSH key
-
Create or convert the key
WinSCP uses PuTTY’s private key format,
.ppk. Start PuTTYgen from the Authentication page of Advanced Site Settings, or from the Tools menu on the Login dialog. Generate a key on your own computer. Prefer a current algorithm such as Ed25519 or a strong RSA key. Protect the.ppkwith a passphrase so a stolen file is not immediately usable.If you already have an OpenSSH private key, WinSCP recognizes the file and can convert it to
.ppk. You can also convert with PuTTYgen or with the/keygencommand-line switch documented by the project. Do not email the private key to anyone, including yourself, in order to “have a backup.” Keep the backup on media you control. -
Install only the public key on the server
The public key is the line you may copy to the server. The administrator, or you if you already have another login, adds it to
~/.ssh/authorized_keysfor that account. The file and the.sshdirectory need permissions OpenSSH will accept. A world-writable.sshdirectory is a common reason the key is ignored. The server administrator should set the directory so only the user can write it. This guide does not recommend mode 777 for that directory or for any other. -
Point the site at the private key
In the Login dialog, select the site, open Advanced, and go to SSH, then Authentication. In the private key file field, choose your
.ppk. Leave the password field empty. Save the site. WinSCP will ask for the key passphrase when it needs to use the key, unless Pageant is already holding that key. -
Use Pageant when you connect many times a day
Pageant is PuTTY’s agent. You start it, load the
.ppk, type the passphrase once, and WinSCP can ask the agent to sign the login. When you log off Windows, Pageant exits and the decrypted key is not left on disk by the agent. Pageant does not help a scheduled task that runs while you are logged off. That case is covered in automation, and it needs a key the task account can read under NTFS permissions, not a prompt. -
Test the key login
Connect. You should not be offered the account password if the server accepts the key. If WinSCP still asks for a password, the server did not accept the key. Check that the public key is in the right user’s
authorized_keys, that you selected the matching.ppk, and that the server allows public-key authentication. Do not “fix” this by turning off the host-key check.
Connect through a proxy
If your network requires a proxy, set it on the site, not as a global guess. Open Advanced Site Settings and use the Connection or Proxy page your version shows for the proxy type the network administrator named. You need the proxy hostname, port, and the proxy username if the proxy itself authenticates. A proxy setting for a network you are not on will make a healthy server look dead. Remove it when you leave that network, or keep it on a separate saved site.
Common mistakes
- Accepting a changed host key because you are in a hurry. That is the moment the check exists for.
- Putting the host-key fingerprint into the private-key field.
- Saving the account password in a site on a lab computer.
- Using port 22 because a guide said “the SFTP port,” when this host listens elsewhere.
- Logging in as a user who cannot write the folder, then treating the refusal as a broken client. That is permission denied.
Expected result
The remote panel shows a real directory on the server, a small upload appears there with the same size as the local file, and a second connection does not ask you to confirm the host key again unless the key changed.
FAQ
Should I log in as root?
Only if you are the administrator and you have a specific reason. Direct root login is often disabled. WinSCP cannot switch user with su in the middle of an SFTP session. None of its protocols allow that. Start the session as the account that should own the files. The permission guide explains the limited cases where an administrator configures sudo for the SFTP subsystem, and why a blanket passwordless sudo rule is a bad idea.
Where is the private key entered?
Advanced Site Settings, SSH, Authentication, private key file. It is not the Password box, and it is not the host-key prompt.
Can I generate the key on the server?
You can, but then the private key starts life on the server and you must move it safely. Generating it on your PC with PuTTYgen keeps the private key local from the start. Only the public key needs to be installed remotely.
The Login dialog never appears.
The option “Show Login dialog on startup and when the last session is closed” may be off. Open preferences and turn it back on, or use the new-session command from the current window.
Previous: ProtocolsNext: File transfer
Related guides
- Upload, download, and synchronize
- Authentication failed
- Host key verification failed
- Use the same host key in a script