X11Forwarding over SSH + PuTTY(or something else)

Hi, the friendliest IT-community of the world!
You guys already helped me with my custom FreeBSD 13.2 installation on ZFS and now I need your help one more time.
I've read that there's way not to use VNC things for remote access to my PC, but using only SSH and remote terminal program like PuTTY, but I cannot find any straightforward instructions how exactly to do it. So I am asking you, experts, to help me to understand:
1. Is it really possible?
2. Is PuTTY good or right choice for this goal?
3. Is there a sort of instructions how to achieve this?
So far there's no important data on my PC, so feel free for experiments. I guess with ZFS's snapshots I can always rollback.

Thank you!
 
2. Is PuTTY good or right choice for this goal?
You don't mention what computer OS you are using to connect to your FreeBSD with ZFS computer.

Putty is primarily a Windows program. Are you trying to connect to FreeBSD from a Windows box?
 
1. yes it's possible

2. if you want to get remote access to a windows client from freebsd, use the net/rdesktop program; if you google 'how to use rdesktop' you will find lots of information on how to do it, the instructions for freebsd are the same as for linux. You will need to "pkg install rdesktop" to use it.

3. If you want to get remote access to a freebsd box from your windows machine (or another linux/freebsd box), you need to run sshd on the target freebsd box and use an ssh client like putty (on windows) or command line 'ssh' on windows/bsd/*nix; since windows now includes a built-in linux subsystem you may be able to get a command-line ssh client for that which might be easier than putty. Personally I find an ssh command line client easier than putty, but maybe that's just me.

Again there are lots of existing guides on the web that tell you how to do this, for example look at https://www.digitalocean.com/commun...-key-based-authentication-on-a-freebsd-server.
 
Keep in mind that X11 forwarding is turned off by default nowadays. You will need to enable it in sshd_config.

Code:
     X11Forwarding
             Specifies whether X11 forwarding is permitted.  The argument must
             be yes or no.  The default is no.

You'll also need an Xserver, on Windows I use VcXsrv. It has to be running before making the connection. Then in Putty, under Connection -> SSH -> X11, enable X11 forwarding. Then make your connection to the FreeBSD host. After logging in, check your environment variables (use env command), the DISPLAY variable will be set to something like "localhost:10". Then just start an X application, xterm for example. The application will run on the FreeBSD host, but the "GUI" interface will appear on your Windows desktop (this is what the VcXsrv does).

Alternatively, you could use MobaXterm instead of PuTTY. MobaXterm already has an Xserver builtin, you just need to enable it.
 
You don't mention what computer OS you are using to connect to your FreeBSD with ZFS computer.

Putty is primarily a Windows program. Are you trying to connect to FreeBSD from a Windows box?
Exactly. Only from Windows PC.
 
Keep in mind that X11 forwarding is turned off by default nowadays. You will need to enable it in sshd_config.

Code:
     X11Forwarding
             Specifies whether X11 forwarding is permitted.  The argument must
             be yes or no.  The default is no.

You'll also need an Xserver, on Windows I use VcXsrv. It has to be running before making the connection. Then in Putty, under Connection -> SSH -> X11, enable X11 forwarding. Then make your connection to the FreeBSD host. After logging in, check your environment variables (use env command), the DISPLAY variable will be set to something like "localhost:10". Then just start an X application, xterm for example. The application will run on the FreeBSD host, but the "GUI" interface will appear on your Windows desktop (this is what the VcXsrv does).

Alternatively, you could use MobaXterm instead of PuTTY. MobaXterm already has an Xserver builtin, you just need to enable it.
It looks like that this is exactly what I was looking for.
Thank you very much.
I will try this next weekends and then report here.
 
I would like to use X11.
Then use ssh -X or put ForwardX11 yes into your .ssh/config.

If you use XDM, you can add the following to your Xservers file:

:0 local /usr/local/bin/X -listen tcp :0

If you use startx/xinit, you can add the -listen to the command line.

Opening your Xserver is not recommended as it exposes your Xserver to attack. You can mitigate this, a little, by applying some firewall rules, i.e. for when you are home. But if any public wifi network uses the same network address as you do at home you're probably opening yourself up needlessly. Forward through ssh. It'll save a lot of headache, avoiding compromise.
 
Hi every one!
So I installed MobaXterm like SirDice suggested.
I set X11Forwarding in sshd_config:
ssh_01.jpg


It works pretty good, but when I try to startx it says this:

ssh_02.jpg


It looks like that I'm missing some more settings.

By default, session settings looking like this:

ssh_02.jpg


Looking forward for your comments.
Thank you.
 
Ok, it's working.
I misunderstood what I was expecting for.
I can start VLC, TigerVNC to my bhyve..., but I have only low performance WiFi-Usb-Stick, so overall performance is poor.
I wonder why I cannot start the whole desktop environment (KDE for example).
Anyway, thanks for your help guys.
I consider this thread as closed.
 
Back
Top