Menu

Log in

Sign up

From beginner to master of web design, coding, infrastructure operation, business development and marketing

  • COURSES
  • HTML & CSS Introduction
  • HTML & CSS Coding with AI
  • Linux Introduction
  • Docker Basics
  • Git & GitHub Introduction
  • JavaScript Coding with AI
  • Django Introduction
  • AWS Basics
  • Figma Introduction
  • SEO Tutorial for Beginners
  • SEO with AI
  • OTHERS
  • About
  • Terms of Service
  • Privacy Policy

© 2024 D-Libro. All Rights Reserved

Linux IntroductionChapter 7. SSH Remote Connection

SSH Remote Login with Visual Studio Code

SSH Remote Login with Visual Studio Code

SSH Remote Login with Visual Studio Code

Using a Visual Studio Code (VS Code) for SSH remote login can significantly improve your productivity. Although it is a remote environment, you can operate as if it were a local environment with high visibility of directory structure and an advanced text editor environment. Here are the steps for establishing SSH remote login with VS Code.

STEP 1. Install Remote Development Extension

Open VSC and select the extension icon from the left sidebar. Search for the Remote Development extension and click on the Install button.

Install Remote Development Extension

Remote Development includes the following extensions:

  • Remote - SSH
  • Remote - SSH: Editing Configuration Files
  • Remote Explorer
  • WSL
  • Dev Containers

STEP 2. Establish SSH Remote Connection

1. Select the remote login icon on the left sidebar in the Remote Explorer

Establish SSH Remote Connection with VS Code: Step 1

2. Click the setting icon to select the SSH config file

Establish SSH Remote Connection with VS Code: Step 2

3. Select your SSH config file

Establish SSH Remote Connection with VS Code: Step 3a

When you select the file, you'll see the config file contents in the right window. (Please refer to the previous section about how to make the config file.)

Establish SSH Remote Connection with VS Code: Step 3b

4. Click on the arrow or window icon of the SSH host name.

By clicking on the arrow icon, you can connect to the host in the same window. When you click on the window icon, a new VS Code window opens and establish the SSH connection in the new window.

Establish SSH Remote Connection with VS Code: Step 4

Note: VS Code may also ask the platform (OS) of the host server. Select Linux if asked.

5. If you set a passphrase for the private key, you need to enter the passphrase to move forward.

Establish SSH Remote Connection with VS Code: Step 5

6. Once VS Code is connected to the remote server, you'll see the status at the bottom left corner of the VS Code window.

Establish SSH Remote Connection with VS Code: Step 6

7. To open directories in the remote server, select the file icon on the left and press the Open Folder button.

Establish SSH Remote Connection with VS Code: Step 7

8. Select the highest directory hierarchy to display in the VS Code editor

If you want to show only your home directory (/home/ubuntu/), press the ok button. You can also change the highest directory. If you want to show the entire directory tree, type / and press the OK button.

Establish SSH Remote Connection with VS Code: Step 8

9. If you set a passphrase for the private key, VS Code will ask for the passphrase again.

Establish SSH Remote Connection with VS Code: Step 9

10. On the first access, VSC will ask if you can trust the folder.

Select the Yes button to connect to the folder.

Establish SSH Remote Connection with VS Code: Step 10

STEP 3. Open a Terminal and check the SSH Remote Login Environment on VS Code

To open a Terminal in the VSC window, select Terminal on the Mac menu bar and click on New Terminal.

Open a Terminal and check the SSH Remote Login Environment on VS Code: Step 1

Now you can work on the remote server as if it were in the local environment.

Open a Terminal and check the SSH Remote Login Environment on VS Code: Step 2

STEP 4. Close SSH Remote Connection

Press the bottom left SSH green icon and find the "Close Remote Connection" menu in the search bar at the top. Click the "Close Remote Connection" menu to close the connection.

Close SSH Remote Connection

IdeaTips: Use Terminal

If you cannot establish the SSH remote connection on VS Code the first time, try the first remote connection using the Terminal application (see the previous section). It may solve the problem. You can use VSC starting from the second connection to the remote server.

Terminal and VS Code

You can also learn this topic offline. Click AmazonKindle.

More Topics to Explore

Adding Page Links with Django's {% url %} Tag

Add Links – {% url %} tag

Replacing Phrases in Vim Editor Normal Mode

Normal Mode (6) – Replace Phrase

Mapping HTTP Requests with Django's URL Dispatcher

URL dispatcher – urls.py

Exploring Permission Modes in Linux

Permission (Access Mode) by Owner Status

Styling Django Allauth with Bootstrap and Crispy Forms

Django Allauth (8) – Add Basic Styling with Bootstrap and Crispy Forms

Adding Page Links with Django's {% url %} Tag

Add Links – {% url %} tag

Replacing Phrases in Vim Editor Normal Mode

Normal Mode (6) – Replace Phrase

Mapping HTTP Requests with Django's URL Dispatcher

URL dispatcher – urls.py

Exploring Permission Modes in Linux

Permission (Access Mode) by Owner Status

Styling Django Allauth with Bootstrap and Crispy Forms

Django Allauth (8) – Add Basic Styling with Bootstrap and Crispy Forms

Tags:

VS Code

SSH

Remote Connection

Linux Introduction
Course Content

Chapter 1. Linux Basics

What Is OS?

CUI and GUI

Linux Distributions

Package Manager

Kernel and Shell

Current Working Directory

Linux Directory Structure

Absolute Path and Relative Path (Linux OS)

Linux Command Syntax

Special Characters and Escape Character

Chapter 2. Linux Key Commands

Setting Up Linux Environment on AWS

pwd (Print Working Directory)

cd (Change Directory)

ls (List Contents of Directory)

mkdir (Make Directory)

rmdir (Remove Directory)

touch (Create File)

rm (Remove File)

mv (Move File and Directory)

cp (Copy File and Directory)

cat (Display File Content)

sort (Sort File Contents)

grep (Global Regular Expression Print)

Regular Expression

find (Find File and Directory)

Wildcard

ln (Create Link to File and Directory)

Chapter 3. Vim Editor

What Is Vim and How to Launch It?

Normal, Insert and Visual Mode

Normal Mode (1) – Move Cursor

Normal Mode (2) – Delete

Normal Mode (3) – Copy and Paste

Normal Mode (4) – Undo and Redo

Normal Mode (5) – Search Phrase

Normal Mode (6) – Replace Phrase

Normal Mode (7) – Save and Exit

Insert Mode

Visual Mode

Chapter 4. User, Group and Permission

What Are User, Group And Permission in Linux?

Permission (Access Mode) by Owner Status

Superuser (Root User) vs. Normal User

sudo (Run Command with Superuser Privileges)

su (Switch User)

useradd (Add User)

passwd (Set Password)

userdel (Delete User)

Group – Primary Group and Secondary Group

groupadd (Add Group)

usermod (Modify User Account Information)

gpasswd (Add and Delete Users to Group)

groupdel (Delete Group)

chown (Change Owner of File and Directory)

chgrp (Change Group of File and Directory)

chmod (Change Access Mode)

chmod Command with Numbers

w and who (Check Current User Login Status)

id and groups (Check User ID and Group)

getent (Display User and Group Data)

Chapter 5. Redirection, Pipe and Shell Script

Standard Input Output and Redirection

Pipe (Combine Commands)

less (Display Content with Pager)

tr (Replace Characters)

cut (Extract Data Sections)

uniq (Extract Unique Data Lines)

Shell Script

echo (Echo input)

read (Read and Store Input)

Shell Variable and Environmental Variable

source (Execute Shell Script and Refresh Environmental Variables)

Chapter 6. Linux Commands for Command Management

history (Check Command History)

alias (Create Command Shortcuts)

man (Display Manual)

type, which and whereis (Display Command Information)

Package Manager Command

tree (Display Directory Tree)

Chapter 7. SSH Remote Connection

SSH (Secure Shell)

Locate .ssh Directory

SSH Remote Login (1) – Use Key Pair Generated by Server

SSH Remote Login (2) – Use Key Pair Generated by Client

SSH Config File

SSH Remote Login with Visual Studio Code

SCP (Secure Copy Protocol)

SCP with SSH Config File

SFTP (Secure File Transfer Protocol)

Other File Transfer Commands

Chapter 8. Linux Process Management

Process and Job

Foreground and Background Jobs

jobs and ps (Display Jobs and Processes)

Signals

Create, Stop and Terminate Jobs

Daemon Processes

What Is Service on Linux?

Systemd

Unit File

Systemctl Sub-Commands

Create Custom Unit and Start at Boot

Firewall

UFW (Uncomplicated Firewall)

Web Server

Launch Apache Web Server

Chapter 1. Linux Basics

What Is OS?

CUI and GUI

Linux Distributions

Package Manager

Kernel and Shell

Current Working Directory

Linux Directory Structure

Absolute Path and Relative Path (Linux OS)

Linux Command Syntax

Special Characters and Escape Character

Chapter 2. Linux Key Commands

Setting Up Linux Environment on AWS

pwd (Print Working Directory)

cd (Change Directory)

ls (List Contents of Directory)

mkdir (Make Directory)

rmdir (Remove Directory)

touch (Create File)

rm (Remove File)

mv (Move File and Directory)

cp (Copy File and Directory)

cat (Display File Content)

sort (Sort File Contents)

grep (Global Regular Expression Print)

Regular Expression

find (Find File and Directory)

Wildcard

ln (Create Link to File and Directory)

Chapter 3. Vim Editor

What Is Vim and How to Launch It?

Normal, Insert and Visual Mode

Normal Mode (1) – Move Cursor

Normal Mode (2) – Delete

Normal Mode (3) – Copy and Paste

Normal Mode (4) – Undo and Redo

Normal Mode (5) – Search Phrase

Normal Mode (6) – Replace Phrase

Normal Mode (7) – Save and Exit

Insert Mode

Visual Mode

Chapter 4. User, Group and Permission

What Are User, Group And Permission in Linux?

Permission (Access Mode) by Owner Status

Superuser (Root User) vs. Normal User

sudo (Run Command with Superuser Privileges)

su (Switch User)

useradd (Add User)

passwd (Set Password)

userdel (Delete User)

Group – Primary Group and Secondary Group

groupadd (Add Group)

usermod (Modify User Account Information)

gpasswd (Add and Delete Users to Group)

groupdel (Delete Group)

chown (Change Owner of File and Directory)

chgrp (Change Group of File and Directory)

chmod (Change Access Mode)

chmod Command with Numbers

w and who (Check Current User Login Status)

id and groups (Check User ID and Group)

getent (Display User and Group Data)

Chapter 5. Redirection, Pipe and Shell Script

Standard Input Output and Redirection

Pipe (Combine Commands)

less (Display Content with Pager)

tr (Replace Characters)

cut (Extract Data Sections)

uniq (Extract Unique Data Lines)

Shell Script

echo (Echo input)

read (Read and Store Input)

Shell Variable and Environmental Variable

source (Execute Shell Script and Refresh Environmental Variables)

Chapter 6. Linux Commands for Command Management

history (Check Command History)

alias (Create Command Shortcuts)

man (Display Manual)

type, which and whereis (Display Command Information)

Package Manager Command

tree (Display Directory Tree)

Chapter 7. SSH Remote Connection

SSH (Secure Shell)

Locate .ssh Directory

SSH Remote Login (1) – Use Key Pair Generated by Server

SSH Remote Login (2) – Use Key Pair Generated by Client

SSH Config File

SSH Remote Login with Visual Studio Code

SCP (Secure Copy Protocol)

SCP with SSH Config File

SFTP (Secure File Transfer Protocol)

Other File Transfer Commands

Chapter 8. Linux Process Management

Process and Job

Foreground and Background Jobs

jobs and ps (Display Jobs and Processes)

Signals

Create, Stop and Terminate Jobs

Daemon Processes

What Is Service on Linux?

Systemd

Unit File

Systemctl Sub-Commands

Create Custom Unit and Start at Boot

Firewall

UFW (Uncomplicated Firewall)

Web Server

Launch Apache Web Server