2

I'm trying to access my laptop while I'm outside my LAN, but I have a problem, at least I think that isn't the normal behavior.

I can't access via SSH if my user isn't locally logged in. I'm not using any display manager, it's the normal Linux login screen.

I'm running Arch Linux.

A video with the problem

My SSH daemon config

#   $OpenBSD: sshd_config,v 1.97 2015/08/06 14:53:21 deraadt 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 5000
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
Protocol 2

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Ciphers and keying
#RekeyLimit default none

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

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

RSAAuthentication yes
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
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and 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 no
PermitEmptyPasswords no

# Change to no to disable s/key passwords
ChallengeResponseAuthentication no

# 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 ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no     # pam does that
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox         # Default for new installations.
#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

# override default of no subsystems
Subsystem   sftp    /usr/lib/ssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   PermitTTY no
#   ForceCommand cvs server

The solution:

My connection was available for that user only, so network manager won't connect to the network unless the user was logged in. To fix that, just check the option All users may connect to this network on the General tab of the connection settings

  • 1
    How do you start sshd? If it is started as a system service, it should be running after the network comes up... – jasonwryan Aug 28 '15 at 21:40
  • Please elaborate, this is too unclear. From where to where do you want to ssh, and what network connections do you have? What works and what does not? – Ned64 Aug 28 '15 at 21:41
  • @jasonwryan I have enabled sshd using systemd – Hugo Rodrigues Aug 28 '15 at 21:49
  • @Ned64 I'm trying to connect from a Windows machine from Internet, I can make the connection, but only if I'm logged in locally, otherwise it gives time out. I use Bitvise SSH, but on putty and on a Linux box the result is the same – Hugo Rodrigues Aug 28 '15 at 21:51
  • That doesn't answer my question. Enabled as a system or user service? What error messages do you get when trying to connect? What is the status of the service when you are logged in as your user vs root? etc... – jasonwryan Aug 28 '15 at 22:02
0

Your problem is probably the fact that when you log off locally your internet connection is being cut off and/or the ssh is stopped. Edit:You cannot use internet without logging in the local account.I as far as I am aware it seems it cannot be done without logging in.

  • That's not usual behaviour. Have you come across this before? – roaima Aug 29 '15 at 8:29
  • @roaima It seems that his right, I just tested the connection with nmap and when I not logged in in Nmap says Host seems down – Hugo Rodrigues Aug 29 '15 at 10:47
  • 1
    What I meant is you need to be logged in to use internet connection and by that - ssh – Radoslav Aug 29 '15 at 13:22
  • 1
    I remember one reasing that might be causing this, if NetworkManager saves the network profile on my account, that information will not be accessible while I'm not logged in. Right? – Hugo Rodrigues Aug 29 '15 at 14:20
  • 1
    I found the problem, just like I said on the last comment, the connection was for that user only. That's way I staid offline when not logged in – Hugo Rodrigues Aug 29 '15 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.