Skip to content

Instantly share code, notes, and snippets.

@TyeolRik
Last active June 21, 2022 16:37
Show Gist options
  • Save TyeolRik/f54aa25ae0649881d6406654ce9282ad to your computer and use it in GitHub Desktop.
Save TyeolRik/f54aa25ae0649881d6406654ce9282ad to your computer and use it in GitHub Desktop.
Host: CentOS 8 Stream / Client: Windows 10 Powershell (exactly Windows Terminal)
#!/bin/bash
# Host: CentOS 8 (192.168.8.119)
# Client: Windows 10 Powershell (192.168.8.120)
# ssh -Y [email protected]
# Before Begin in Client(Windows)
# 1. Install VcXsrv (https://sourceforge.net/projects/vcxsrv/)
# 2. Execute Xlaunch.exe
# Check {Multiple Windows and Display number = -1, Start no client, {Clipboard, Primary Selection, Native opengl, Additional parameter: "-ac"} -> Save Configuration}
# 3. Turn on Powershell
# > Set-NetFirewallRule -DisplayName "Xming X Server" -Enabled True -Profile Any # I don't know why DisplayName is "Xming". But it works....
# > $Env:DISPLAY = "localhost:0.0"
# Caution. Keyword is "X11". If there is trouble, do
# > ssh -Y -v [email protected] # -v means verbose
# and Check outputs.
dnf install -y epel-release openssh-server xauth
systemctl stop firewalld
sed -i 's/# Host */Host */g' /etc/ssh/ssh_config
sed -i 's/# ForwardAgent no/ ForwardAgent yes/g' /etc/ssh/ssh_config
sed -i 's/# ForwardX11 no/ ForwardX11 yes/g' /etc/ssh/ssh_config
sed -i 's/#X11Forwarding no/X11Forwarding yes/g' /etc/ssh/sshd_config
sed -i 's/#X11Forwarding no/X11Forwarding yes/g' /etc/ssh/sshd_config
sed -i 's/#Compression delayed/Compression yes/g' /etc/ssh/sshd_config
systemctl restart sshd
echo "# Xming" >> ~/.bash_profile
echo "export DISPLAY=127.0.0.1:10.0" >> ~/.bash_profile
xauth add 192.168.8.120:0 . 0123456789abcdef0123456789abcdef # That IP address is Client's IP
reboot now
# After reboot and login within below command
# > ssh -Y -v [email protected]
# [root@localhost ~]# gedit # for checking X11 Forwarding well (GUI)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment