Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Other Things Gentoo
  • Search

ssh X-forwarding for dummies (solved)

Still need help with Gentoo, and your question doesn't fit in the above forums? Here is your last bastion of hope.
Post Reply
Advanced search
6 posts • Page 1 of 1
Author
Message
Spanik
Veteran
Veteran
Posts: 1170
Joined: Fri Dec 12, 2003 9:10 pm
Location: Belgium

ssh X-forwarding for dummies (solved)

  • Quote

Post by Spanik » Tue Jan 27, 2026 8:55 am

Setting up my small pc for audio dsp I came to the conclusion that using ssh and remote login would be far easier than always switching my screen, keyboard and mouse. So I tried ssh from a terminal into the remote_pc from the desktop and this was indeed a lot easier to install the rest of the needed software and plugins. Now for some things it would be easier to have the graphical applications so I looked into X11 forwarding. But here the articles I found seem to be overly simple and often not clear about what has to happen on the remote machine (small pc for dsp) and what needs to be done on the local machine (desktop). Also each search turns up different commands for achieving the same thing which doesn't make it easy to find what is correct.

I have done the following on the remote machine:

Code: Select all

- /etc/ssh/ssh_config  
     X11forwarding yes
- /etc/ssh/sshd_config
     X11forwarding yes
     X11DisplayOffset 10
Xauth is installed on the remote. I tried to generate the xauth keys but when I run "xauth generate" as normal user or as root
I get "xauth: (argv):1: bad "generate" command line".

So I'm clearly missing something.

Questions:
1: does the X server needs to be running on the remote machine? Or does the X server on the local machine the job from the data it receives from the remote through ssh? This is something that is far from clear to me. When the remote machine starts, it goes to runlevel 3, a login prompt, X isn't running.
2: Do I need the same ssh_config and sshd_config settings on the local machine?
3: If I can get xauth to generate the keys, do I need to add it to runlevel default?

Fixed not matching code tags. -- Banana
Last edited by Spanik on Mon Feb 02, 2026 8:32 am, edited 1 time in total.
Expert in non-working solutions
Top
Hu
Administrator
Administrator
Posts: 24403
Joined: Tue Mar 06, 2007 5:38 am

Re: ssh X-forwarding for dummies

  • Quote

Post by Hu » Tue Jan 27, 2026 2:57 pm

Spanik wrote:1: does the X server needs to be running on the remote machine? Or does the X server on the local machine the job from the data it receives from the remote through ssh? This is something that is far from clear to me. When the remote machine starts, it goes to runlevel 3, a login prompt, X isn't running.
The machine attached to the monitor you will use needs to run Xorg, and display on that monitor. The machine which does not display to a monitor does not need to run, or even install, Xorg. The no-display machine will relay its contents over the network to the X server, which will then render them on its attached monitor.
Spanik wrote:2: Do I need the same ssh_config and sshd_config settings on the local machine?
No. You need the ssh client machine to have ForwardX11 enabled in ~/.ssh/config or /etc/ssh/ssh_config. You need the ssh server machine to have ForwardX11 enabled in its /etc/ssh/sshd_config.
Spanik wrote:3: If I can get xauth to generate the keys, do I need to add it to runlevel default?
You don't need to interact with xauth explicitly at all. Once it is installed, ssh should handle the xauth setup on the ssh server for you.
Top
Spanik
Veteran
Veteran
Posts: 1170
Joined: Fri Dec 12, 2003 9:10 pm
Location: Belgium

  • Quote

Post by Spanik » Fri Jan 30, 2026 8:20 am

A bit later, job got in the way.

Local pc /etc/ssh/ssh_config:

Code: Select all

#	$OpenBSD: ssh_config,v 1.37 2025/05/06 05:40:56 djm Exp $

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Make sure that all Host and Match options are below this Include!
Include "/etc/ssh/ssh_config.d/*.conf"

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

# Host *
#   ForwardAgent no
   ForwardX11 yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   BatchMode no
#   CheckHostIP no
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_ecdsa
#   IdentityFile ~/.ssh/id_ed25519
#   Port 22
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h
#   UserKnownHostsFile ~/.ssh/known_hosts.d/%k
Remote pc /etc/ssh/ssh_config:

Code: Select all

#	$OpenBSD: ssh_config,v 1.37 2025/05/06 05:40:56 djm Exp $

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Make sure that all Host and Match options are below this Include!
Include "/etc/ssh/ssh_config.d/*.conf"

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

# Host *
#   ForwardAgent no
   ForwardX11 yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   BatchMode no
#   CheckHostIP no
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_ecdsa
#   IdentityFile ~/.ssh/id_ed25519
#   Port 22
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h
#   UserKnownHostsFile ~/.ssh/known_hosts.d/%k

Code: Select all

emerge --search xauth
  
[ Results for search key : xauth ]
Searching...

*  acct-group/gauth
      Latest version available: 0-r2
      Latest version installed: [ Not Installed ]
      Size of files: 0 KiB
      Homepage:      
      Description:   A group for sys-auth/google-authenticator-wrappers
      License:       

*  acct-user/gauth
      Latest version available: 0-r2
      Latest version installed: [ Not Installed ]
      Size of files: 0 KiB
      Homepage:      
      Description:   A user for sys-auth/google-authenticator-wrappers
      License:       

*  dev-ruby/oauth
      Latest version available: 1.1.3
      Latest version installed: [ Not Installed ]
      Size of files: 275 KiB
      Homepage:      https://github.com/ruby-oauth/oauth
      Description:   A RubyGem for implementing both OAuth clients and servers
      License:       MIT

*  dev-ruby/xpath
      Latest version available: 3.2.0-r1
      Latest version installed: [ Not Installed ]
      Size of files: 14 KiB
      Homepage:      https://github.com/teamcapybara/xpath
      Description:   XPath is a Ruby DSL around a subset of XPath 1.0
      License:       MIT

*  kde-frameworks/kauth
      Latest version available: 6.22.0
      Latest version installed: 6.22.0
      Size of files: 2220 KiB
      Homepage:      https://develop.kde.org/products/frameworks/
      Description:   Framework to let applications perform actions as a privileged user
      License:       LGPL-2.1+

*  x11-apps/xauth
      Latest version available: 1.1.5
      Latest version installed: 1.1.5
      Size of files: 162 KiB
      Homepage:      https://www.x.org/wiki/ https://gitlab.freedesktop.org/xorg/app/xauth
      Description:   X authority file utility
      License:       MIT

[ Applications found : 6 ]
When I try to run qjackctl on the local machine:

Code: Select all

$ ssh -X ikke@192.168.2.11 qjackctl
(ikke@192.168.2.11) Password: 
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, minimal, offscreen, vkkhrdisplay, vnc, xcb, wayland-brcm, wayland-egl, wayland.

ikke@daw ~ $ 
So it looks like xauth isn't starting.
Expert in non-working solutions
Top
Spanik
Veteran
Veteran
Posts: 1170
Joined: Fri Dec 12, 2003 9:10 pm
Location: Belgium

  • Quote

Post by Spanik » Fri Jan 30, 2026 8:43 am

Forgot /etc/ssh/sshd_config of the local pc:

Code: Select all

#	$OpenBSD: sshd_config,v 1.105 2024/12/03 14:12:47 dtucker Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
#AuthorizedKeysFile	.ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to "no" here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to "no" to disable keyboard-interactive authentication.  Depending on
# the system's configuration, this may involve passwords, challenge-response,
# one-time passwords or some combination of these and other methods.
#KbdInteractiveAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the KbdInteractiveAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via KbdInteractiveAuthentication may bypass
# the setting of "PermitRootLogin prohibit-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and KbdInteractiveAuthentication to 'no'.
#UsePAM no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Make sure that all Match options are below this Include!
Include "/etc/ssh/sshd_config.d/*.conf"

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	PermitTTY no
#	ForceCommand cvs server
Expert in non-working solutions
Top
sublogic
Guru
Guru
User avatar
Posts: 388
Joined: Mon Mar 21, 2022 3:02 am
Location: Pennsylvania, USA

  • Quote

Post by sublogic » Fri Jan 30, 2026 11:27 pm

Spanik wrote:When I try to run qjackctl on the local machine:

Code: Select all

$ ssh -X ikke@192.168.2.11 qjackctl
(ikke@192.168.2.11) Password: 
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Try ssh -Y instead of ssh -X (assuming trusted hosts on a trusted network).
The practical unit of "Learning Experience" is the milli-Gentoo.
Top
Spanik
Veteran
Veteran
Posts: 1170
Joined: Fri Dec 12, 2003 9:10 pm
Location: Belgium

  • Quote

Post by Spanik » Mon Feb 02, 2026 8:32 am

sublogic wrote:Try ssh -Y instead of ssh -X (assuming trusted hosts on a trusted network).
Thanks, this works first time. The network and hosts are on a network I trust as much as I'm able to configure a network. But it is right now more for configuration, once that over it will be a non-connected device. So I guess it is ok to use it this way.
Expert in non-working solutions
Top
Post Reply

6 posts • Page 1 of 1

Return to “Other Things Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic