You are not logged in.
Pages: 1
Hello,
I have two arch devices (client and server) which I am attempting to connect to via SSH. The issue is however that I can only connect to the server if a local login is already established.
ssh -V
OpenSSH_9.0p1, OpenSSL 1.1.1q 5 Jul 2022The versions are the same for both client and server. The SSH connection works if I am already
logged in at the server, however if I do not:
$PS1:[41]~ $ ssh -v SERVER
OpenSSH_9.0p1, OpenSSL 1.1.1q 5 Jul 2022
debug1: Reading configuration data /home/USER/.ssh/config
debug1: /home/USER/.ssh/config line 4: Applying options for SERVER
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 192.168.0.20 [192.168.0.20] port 22.
debug1: connect to address 192.168.0.20 port 22: No route to host
ssh: connect to host 192.168.0.20 port 22: No route to hostThere was no journalctl output. Any help is appreciated.
Last edited by variable-root (2022-08-03 00:58:32)
Offline
Hello,
I have never heard of the problem that you cannot connect to a system via ssh if no user is locally logged in.
Based on your ssh -V Server output, we can see that your system has no route to the SERVER.
Check if both machines are in the same subnet and maybe post the output from
$ip routeand
$ip aGreetings
Grigorios
Last edited by Grigorios (2022-07-31 08:07:46)
Offline
My SWAG (Scientific Wild Ass Guess): The server is using a WiFi connection? You are using something on the server to control the Network connection that is based not on system level credentials, but rather user level credentials: Like i3wm with NetworkManager? If this is the case, the Network connection will not associate until the user logs in. You can check that by checking the journal.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Is the server and/or client are virtual machines on same host ?
Normally a VM has no route to reach its host, it just gives you a gateway access to internet.
Offline
@ewaller & @Perfmonk
The server is a ethernet wired seperate station. It is also not a VM but bootable archlinux on the disk.
@Grigorios
For client (with MAC addresses REDACTED for security):
ip route
default via 192.168.0.1 dev wlp2s0 proto dhcp src 192.168.0.50 metric 600
192.168.0.0/24 dev wlp2s0 proto kernel scope link src 192.168.0.50 metric 600ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: enp3s0f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether REDACTED
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether REDACTED permaddr REDACTED
inet 192.168.0.50/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp2s0
valid_lft 604730sec preferred_lft 604730sec
inet6 REDACTED scope global dynamic noprefixroute
valid_lft 3532sec preferred_lft 3532sec
inet6 REDACTED scope global dynamic noprefixroute
valid_lft 172799sec preferred_lft 172799sec
inet6 REDACTED scope link noprefixroute
valid_lft forever preferred_lft foreverFor server:
ip route
default via 192.168.0.1 dev enp33s0 proto dhcp src 192.168.0.20 metric 100
192.168.0.0/24 dev enp33s0 proto kernel scope link src 192.168.0.20 metric 100ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp33s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether REDACTED permaddr REDACTED
inet 192.168.0.20/24 brd 192.168.0.255 scope global dynamic noprefixroute enp33s0
valid_lft 534074sec preferred_lft 534074secIt is a strange issue, and unfortunately the few posts made by other users various forums are all dead ends as well.
Offline
ssh: connect to host 192.168.0.20 port 22: No route to host is either a really weird bug in the ssh client or obvious.
W/o being logged into the server (what I understand is the problematic condition, it's NOT that you first need to locally log into the client, right?)
ip r 192.168.0.20
ping -c 192.168.0.20
nmap -p 192.168.0.20Do you configure a static IP on the server?
How is the NIC configured to begin with (you could still eg. be activating w/ a user service - wifi or not)?
It's *only* about being logged into the server, you're positive (not "I think", *know*) that it's up, running and not in S3?
=> Try to disable the NICs power saving, set /sys/class/net/enp33s0/power/control to "on", https://wiki.archlinux.org/title/Power_ … Management
or disable aspm altogether (for a quick test), "pcie_aspm=off", https://wiki.archlinux.org/title/Kernel_parameters
Offline
@seth
The current server behavior is to only allow a valid remote ssh connection from the client if the client is already logged in locally.
The desired server behavior is to allow a valid remote ssh connection from the client after the server completes booting (multi-user.target).
I have reinstalled open-ssh on both the client and server. I have moved the authorized_keys file outside the user home directory. As you suggested I also:
Disabled the NICs power-saving by setting set /sys/class/net/enp33s0/power/control to "on" from "auto".
Set pcie_aspm=off during boot. Unfortunately, none of these steps resolved the issue.
Using the ping command, and root login I was able to determine - as you suspected - that NIC configuration seems to only be happening when the user
is logged in. As soon as the user logs out the NIC releases the static IP and goes down. I am not certain as to why since NIC configuration is handled by NetworkManager.service which
is a target.wants of multi-user.
After boot without local user login:
http://ix.io/46q7
http://ix.io/46q8
Offline
But how is the connection configured in NM? I remember that nm-connection-editor has a checkbox with something like "allow all users to connect". If that is unchecked, I think it would explain this behavior.
Offline
Aug 02 03:25:51 HOSTNAME_REDACTED NetworkManager[520]: <info> [1659410751.4985] device (enp33s0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
find /etc/systemd -type l -exec test -f {} \; -print | awk -F'/' '{ printf ("%-40s | %s\n", $(NF-0), $(NF-1)) }' | sort -fOtherwise see https://wiki.archlinux.org/title/Networ … ic_devices
Offline
@Raynman
This turned out to be exactly the issue. After setting the option I was able to ssh into the server without login as desired.
Thank you all for the help.
Offline
enp33s0 is an ethernet NIC and afaiu NM this doesn't require sharing.
There might be a conflicting service or you blocked the NIC from autoconnection.
=> see #9
Also, ftr. w/ only one wired NIC being autoconnected and on a server, you don't need NM at all - just dhcpcd will do.
Offline
Pages: 1