Skip to content

Instantly share code, notes, and snippets.

@Udara-Dananjaya
Created August 15, 2023 07:17
Show Gist options
  • Save Udara-Dananjaya/0e8c8dd10b1f0e7a92f11c51c2f0673c to your computer and use it in GitHub Desktop.
Save Udara-Dananjaya/0e8c8dd10b1f0e7a92f11c51c2f0673c to your computer and use it in GitHub Desktop.
Configure VSCode-remote SSH: Set up user access, VS Code, GIT, and OpenSSH for Ubuntu and Windows. Seamlessly edit remote files!
# Configure VSCode-remote SSH for Ubuntu and Windows
# Setup user account with SSH access on Ubuntu
sudo -s
adduser username
sudo usermod -aG sudo username
sudo ufw app list
sudo ufw allow OpenSSH
sudo ufw enable # Confirm with 'y'
sudo ufw status
sudo nano /etc/ssh/sshd_config # Open SSH configuration file
# Set 'PasswordAuthentication' to 'yes'
# PasswordAuthentication yes
sudo ufw reload
sudo service ssh restart
sudo ssh username@your_server_ip
# Grant access to the user on Ubuntu
sudo chown -R username /path/to/folder
sudo chmod -R 777 /var/www/site_name
# Download and install VS Code and Remote - SSH Extension on Windows
# Links:
# https://code.visualstudio.com/download
# https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh
# Download GIT and OpenSSH for Windows
# Links:
# https://github.com/PowerShell/Win32-OpenSSH/releases/tag/v8.9.1.0p1-Beta (OpenSSH)
# https://git-scm.com/download/win (GIT Portable Edition)
# Extract to this location:
# C:\Users\username\AppData\Local\Programs
# Configure SSH for VSCode
# Create or update "C:\Users\username\.ssh\config" file
Host 127.0.0.1
HostName 127.0.0.1
User username
# Set remote SSH path in VSCode settings
# File -> Preferences -> Settings -> Search "remote.SSH.path" and set the path
# "remote.SSH.path": "C:\\Users\\username\\AppData\\Local\\Programs\\OpenSSH\\ssh.exe"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment