# VS Code to a remote SSH host



## Farhan Khan (Feb 25, 2022)

Hi all,
From either a Linux or Mac host, is there a way to edit code on a FreeBSD host via ssh? For some reason the ssh connection fails, reporting connection timeouts. I suspect this is because VS code runs local code on the endpoint host, but I could be wrong.
Thanks!


----------



## D-FENS (Feb 25, 2022)

- You could use any graphical editor via VNC, just start a VNC server on the FreeBSD.
- Another option is to enable X-forwarding when connecting via ssh. Start ssh with an additional parameter -X. Also on the SSH server you need to enable X-Forwarding in the configuration. Then whenever you start a graphical application in your SSH session, the GUI will open on your local X-Server.
- Years ago I used nomachine (nxserver/nxclient) for remote access and it was great. I am not aware if it works on FreeBSD.
- You can always fall back on using a text-mode editor if it does not work out with GUI. Pick your choice - vim, emacs, or whatever. I use mcedit and edit code mostly in GUI mode.


----------



## richardtoohey2 (Feb 25, 2022)

Don't think exactly what you are asking, but _might_ be relevant - just because you talked of ssh timeouts: https://patrickmn.com/aside/how-to-keep-alive-ssh-sessions/


----------



## ct85711 (Feb 25, 2022)

A couple possibilities on settings in VS Code you could try, 
	
	



```
remote.SSH.connectTimeout
```
 by increasing the connection timeout.  I don't know if the 
	
	



```
remote.SSH.remoteServerListenOnSocket
```
 may be helpful or not.


----------



## SirDice (Feb 25, 2022)

Farhan Khan said:


> For some reason the ssh connection fails, reporting connection timeouts.


Firewall on the FreeBSD host blocking that connection? Check /var/log/auth.log to see if there's even a connection being registered.


----------



## Farhan Khan (Feb 25, 2022)

The connection definitely happens. VS Code's SSH log show the MOTD.


----------

