Skip to main content

Need a powerful server for your projects?

Discover our offers

SFTP Extension for VSCode

This guide explains how to install and configure the SFTP extension on Visual Studio Code to manage your files on a remote server (VPS, game server, web hosting, etc.).

Prerequisites

  • Visual Studio Code installed
  • Your server connection credentials (provided by YorkHost or your hosting provider)

Installing the Extension

  1. Open Visual Studio Code
  2. Click on the Extensions icon in the sidebar (or Ctrl+Shift+X)
  3. Search for "SFTP" by Natizyskunk
  4. Click Install
Recommendation

The SFTP extension by Natizyskunk is the most actively maintained and recommended.

Configuration

Step 1: Open a Local Folder

Create or open a local folder that will serve as a mirror for your remote files:

File → Open Folder → Select your working folder

Step 2: Create the Configuration File

  1. Press Ctrl+Shift+P (or Cmd+Shift+P on Mac)
  2. Type "SFTP: Config" and press Enter
  3. A sftp.json file will be created in the .vscode folder

Configurations by Server Type

Game Server (Pterodactyl/Game Panel)

For FiveM, Minecraft, GMod servers, etc. hosted on a panel:

{
"name": "My Game Server",
"host": "node1.yorkhost.fr",
"protocol": "sftp",
"port": 2022,
"username": "your_username.xxx",
"password": "your_password",
"remotePath": "/",
"uploadOnSave": true,
"useTempFile": false,
"openSsh": false
}
Where to find your credentials?
  1. Log in to the Game Panel:
  2. Select your server
  3. Go to SettingsSFTP Details
  4. You'll find: host, port, username and password

Linux VPS (SSH/SFTP)

For a Linux VPS with SSH access:

{
"name": "My Linux VPS",
"host": "your-vps-ip",
"protocol": "sftp",
"port": 22,
"username": "root",
"password": "your_password",
"remotePath": "/home/",
"uploadOnSave": true,
"useTempFile": false,
"openSsh": false
}
{
"name": "My Linux VPS (SSH Key)",
"host": "your-vps-ip",
"protocol": "sftp",
"port": 22,
"username": "root",
"privateKeyPath": "C:/Users/YourName/.ssh/id_rsa",
"passphrase": "your_passphrase_if_any",
"remotePath": "/home/",
"uploadOnSave": true
}
SSH Key

To generate an SSH key:

ssh-keygen -t rsa -b 4096

Then copy the public key to your server:

ssh-copy-id root@your-vps-ip

Classic Web Hosting (cPanel, Plesk)

{
"name": "My Website",
"host": "ftp.yourdomain.com",
"protocol": "sftp",
"port": 22,
"username": "your_cpanel_username",
"password": "your_password",
"remotePath": "/public_html/",
"uploadOnSave": true,
"useTempFile": false,
"openSsh": false
}
FTP vs SFTP

Always prefer SFTP (port 22) over FTP (port 21) for a secure and encrypted connection.


Windows VPS (SFTP via OpenSSH)

If OpenSSH is installed on your Windows VPS:

{
"name": "My Windows VPS",
"host": "your-vps-ip",
"protocol": "sftp",
"port": 22,
"username": "Administrator",
"password": "your_password",
"remotePath": "C:/Users/Administrator/",
"uploadOnSave": true
}

Important Configuration Options

OptionDescriptionDefault Value
uploadOnSaveAuto upload on every savefalse
downloadOnOpenDownload remote file on openfalse
syncModeSynchronization mode (update, full)update
ignoreFiles/folders to ignore[]
watcher.filesWatch filesfalse
watcher.autoUploadAuto upload watched filestrue

Advanced Configuration Example

{
"name": "Production Server",
"host": "your-ip",
"protocol": "sftp",
"port": 22,
"username": "root",
"password": "your_password",
"remotePath": "/var/www/mysite/",
"uploadOnSave": true,
"downloadOnOpen": false,
"syncMode": "update",
"ignore": [
".vscode",
".git",
".DS_Store",
"node_modules",
"*.log"
],
"watcher": {
"files": "**/*",
"autoUpload": true,
"autoDelete": false
}
}

Useful Commands

Press Ctrl+Shift+P then type:

CommandDescription
SFTP: ConfigCreate/edit configuration
SFTP: UploadUpload current file
SFTP: DownloadDownload current file
SFTP: Sync Local → RemoteSync local to remote
SFTP: Sync Remote → LocalSync remote to local
SFTP: ListBrowse remote files
SFTP: Upload FolderUpload entire folder

Troubleshooting

"Connection refused" Error

  • Check that the port is correct (22 for SSH/SFTP, 2022 for Game Panel)
  • Verify your IP is not blocked by the firewall

"Authentication failed" Error

  • Check your credentials (username/password)
  • For Game Panel, use the full username.xxx format

"ECONNRESET" Error

  • Network connection issue
  • Try reconnecting

Files Not Syncing

  • Check that uploadOnSave is set to true
  • Verify the file is not in the ignore list

Best Practices

  1. Never store passwords in plain text - Use SSH keys when possible
  2. Add .vscode/sftp.json to your .gitignore - To avoid sharing credentials
  3. Use ignore to exclude - node_modules, .git, log files
  4. Make backups - Before any major synchronization
Security

Never commit your sftp.json file containing passwords to Git! Add this line to your .gitignore:

.vscode/sftp.json