You are not logged in.

#1 2020-11-03 10:53:49

latgarf
Member
Registered: 2012-12-14
Posts: 32

ssh between local machines (Xorg problem)

When I ssh from laptop1 to laptop2, I get this error:

[user1@laptop1 ~]$ ssh user2@192.168.1.105
/usr/lib/Xorg.wrap: Only console users are allowed to run the X server
xinit: giving up
xinit: unable to connect to X server: Network is unreachable
xinit: server error
Couldn't get a file descriptor referring to the console.
Connection to 192.168.1.105 closed.

I don't need X during my ssh session.
Maybe the culprit is that my laptops are configured to auto-start X on login via ~/.bash_profile

[[ -f ~/.bashrc ]] && . ~/.bashrc
[[ -z $DISPLAY && $XDG_VTNR -le 2 ]] && exec startx

Thanks for any advice on how to fix this!

Offline

#2 2020-11-03 11:11:22

koffeinfriedhof
Member
Registered: 2017-11-30
Posts: 91

Re: ssh between local machines (Xorg problem)

You could check for ssh vial

if [[ -n $SSH_CLIENT ]]; then without x; else do with x; fi

Offline

#3 2020-11-03 11:33:03

latgarf
Member
Registered: 2012-12-14
Posts: 32

Re: ssh between local machines (Xorg problem)

koffeinfriedhof wrote:

You could check for ssh via

if [[ -n $SSH_CLIENT ]]; then without x; else do with x; fi

Sorry, I'm newbish here -
1. Is this line to be used in ~/.bash_profile file?
2. Is it to be used on the ssh server or ssh client computer?
3. Is it pseudocode or proper syntax?

Thanks!

Last edited by latgarf (2020-11-03 11:36:04)

Offline

#4 2020-11-03 11:53:40

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,542

Re: ssh between local machines (Xorg problem)

Why not setup a login manager on the machine instead of using startx in .bash_profile?  Or just manually startx after login.

Running a shell in X, would be kinda hey let's start x, oh wait we're already running x.

ssh -Y would activate X clients on ssh client side, so startx from there would be unnecessary.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#5 2020-11-03 14:39:16

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,706

Re: ssh between local machines (Xorg problem)

$XDG_VTNR is probably empty (check that) and the [[ test will treat that as "0" - see and try https://wiki.archlinux.org/index.php/Xi … X_at_login

Offline

#6 2020-11-03 14:45:01

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: ssh between local machines (Xorg problem)

If you really want to be able to start X on tty1 and tty2 of the local machine, just explicitly check whether XDG_VTNR is actually set first:

[[ -z $DISPLAY && -n $XDG_VTNR && $XDG_VTNR -le 2 ]] && exec startx

"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB