-
LINUX > éditer des fichiers distants avec Visual Studio Code
1. Installer l’extension Remote VSCode
Dans VS Code > CTRL+SHIFT+X pour ouvrir le panneau d’extensions > taper Remote VSCode > Click Remote VSCode in the list of results.
On the right of the VS Code window, click Install.
2. Installer rmate dans la machine distante
sudo -i wget -O /usr/local/bin/rmate https://raw.github.com/aurora/rmate/master/rmate chmod a+x /usr/local/bin/rmate
3. Installer SSH sur le distant
sudo apt install openssh-client sudo apt install openssh-server
sudo vi /etc/ssh/sshd_config PasswordAuthentication yes
sudo service ssh restart
ssh localhost -l nom
4. Lancer rmate dans le distant
Dans VSCode > presser F1 pour ouvrir la palette de commandes > taper Remote: Start Server puis ENTER.
You should see the server starting icon turning in the bottom left corner of the VS Code window.
5. Connexion au distant via SSH
Dans VSCode :
ssh -R 52698:localhost:52698 192.168.0.3 -l nom_user
6. Ouvrir un fichier distant
Si le fichier est protégé en écriture, ajouter -f switch to the rmate command to force it to open the file. Both sudo and -f are optional.
sudo rmate -f /etc/ssh/sshd_config