https://github.com/oc8/ssh-vm-tuto
TUTO | Connect to a VM via SSH from VS Code
https://github.com/oc8/ssh-vm-tuto
ssh tutorial vm
Last synced: 3 months ago
JSON representation
TUTO | Connect to a VM via SSH from VS Code
- Host: GitHub
- URL: https://github.com/oc8/ssh-vm-tuto
- Owner: oc8
- Created: 2022-01-19T14:57:54.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-05T19:04:33.000Z (over 2 years ago)
- Last Synced: 2025-01-26T07:26:00.478Z (4 months ago)
- Topics: ssh, tutorial, vm
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SSH-VM-TUTO
This tutorial explains how to connect to a VM via SSH from a terminal and Visual Studio Code. This can be useful for working inside a VM from your local computer.
## Configuring your VM
To be able to connect to your VM via SSH, you must first enable the SSH server on your VM. Follow these steps to do so:
1. Open the settings for your VM and enable file sharing and the SSH port. You should have something similar to this:

2. In the terminal of your VM, add your user to the `sudo` group with the following command:
-
```
sudo usermod -aG sudo {loginVM}
3. Install the openssh-server and ssh packages with the following commands:
-
```
sudo apt-get install openssh-server ssh
## Connecting from a terminal
-
```
ssh -p 3022 {loginVM}@127.0.0.1
## Connecting from Visual Studio Code
To connect to your VM via SSH from Visual Studio Code, follow these steps:- Install the "Remote - SSH" extension from the Visual Studio Code marketplace.
- Click on the "Remote" icon in the sidebar and select "Add New SSH Host...".
- Enter the following connection information:
- Address: ssh -p 3022 {loginVM}@127.0.0.1
- Password: the password for your VM![]()
- If you don't have editing privileges
```
sudo chmod -R 755 .
- Error: kex_exchange_identification: Connection closed by remote host
```
sudo service ssh start