Remote Connections from MacBook Client to RHEL8 Host via VNC tunneled over SSH
Configuration
Host and client need to be configured before connecting.
Step 1: On RHEL Desktops (Server/Host)
Step 1: SSH server must be installed and running:
To check: systemctl status sshd
To Install: sudo dnf install -y openssh-server
to install openssh serversudo systemctl enable --now sshd
to enable sshsudo firewalld-cmd --permanent --add-service=ssh
to allow SSH trafficsudo firewall-cmd --reload
to apply changessudo systemctl status sshd
to check ssh status
Step 2: Install VNC Server: sudo dnf install -y tigervnc-server
to install
Step 3: Set VNC Password:vncpasswd
Set to a secure password that meets UMD's password requirements
Step 4: Start VNC Server for initial setup:vncserver
Should start a session on :1 which maps to port 5901
Step 5: Stop server to start configuringvncserver -kill :1
Step 6: Create/edit file ~/.vnc/xstartupgedit ~/.vnc/xstartup
Ensure it includes:[ -x /etc/X11/xinit/Xsession ] && exec /etc/X11/xinit/Xsession
exec gnome-session
chmod +x ~/.vnc/xstartup
Step 2: On Macbook (Client):
Step 1: Create SSH Tunnel:ssh -L 5901:localhost:5901 username@desktop_hostname
ex: [labadmin or ncdcheks, ENEELDREN033278.eng.umd.edu]
This forwads the MacBooks local port 5901 to the remote machine's VNC port 5901
Leave this terminal window open to keep the tunnel active
Step 2: From MacBook, Connect with to the desktop with a VNC viewer
Option 1: Built-in Screen Sharing
In finder, press cmd + K or click go, then connect to server
Enter: vnc://localhost:5901
Enter the vnc password when prompted
or
Option 2: Other VNC viewers
If you want to use a different VNC viewer (like TigerVNC or RealVNC), you'll have to install them
After installing, open the viewer and connect to localhost:5901
Connecting
Each time you want to connect via VNC:
Step 1: On RHEL Desktop
Step 1: Start VNC server on the desktop/hostvncserver
You can ssh into the desktop to run this command if connecting remotely:
ssh username@desktop_hostname
https://ask.eng.umd.edu/132048 https://ask.eng.umd.edu/131322
Step 2: On Macbook (Client)
Step 1: Open SSH Tunnel ssh -L 5901:localhost:5901 username@desktop_hostname
[labadmin or ncdcheks, ENEELDREN033278.eng.umd.edu ]
Leave this terminal window open to keep the tunnel active
Step 2: Connect to the desktop using option 1 or option 2 (built-in screen sharing or VNC Viewer) to connect to localhost:5901