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β
- Open Visual Studio Code
- Click on the Extensions icon in the sidebar (or
Ctrl+Shift+X) - Search for "SFTP" by Natizyskunk
- 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β
- Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Type "SFTP: Config" and press Enter
- A
sftp.jsonfile will be created in the.vscodefolder
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?
- Log in to the Game Panel
- Select your server
- Go to Settings β SFTP Details
- 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
}
With SSH Key (recommended for security)β
{
"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β
| Option | Description | Default Value |
|---|---|---|
uploadOnSave | Auto upload on every save | false |
downloadOnOpen | Download remote file on open | false |
syncMode | Synchronization mode (update, full) | update |
ignore | Files/folders to ignore | [] |
watcher.files | Watch files | false |
watcher.autoUpload | Auto upload watched files | true |
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:
| Command | Description |
|---|---|
SFTP: Config | Create/edit configuration |
SFTP: Upload | Upload current file |
SFTP: Download | Download current file |
SFTP: Sync Local β Remote | Sync local to remote |
SFTP: Sync Remote β Local | Sync remote to local |
SFTP: List | Browse remote files |
SFTP: Upload Folder | Upload 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.xxxformat
"ECONNRESET" Errorβ
- Network connection issue
- Try reconnecting
Files Not Syncingβ
- Check that
uploadOnSaveis set totrue - Verify the file is not in the
ignorelist
Best Practicesβ
- Never store passwords in plain text - Use SSH keys when possible
- Add
.vscode/sftp.jsonto your.gitignore- To avoid sharing credentials - Use
ignoreto exclude -node_modules,.git, log files - 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