I have ArchLinux (kernel 4.8.4-1) machine which I try to turn into SSH server. For the last few days I've been struggling with getting it to work. I have read loads of articles, tutorials and other stuff like this but all of them look the same and none solves my problem. After running $ssh -vvv alagris@OelkozadamI get:OpenSSH_7.3p1, OpenSSL 1.0.2j  26 Sep 2016debug1: Reading configuration data /home/alagris/.ssh/configdebug1: /home/alagris/.ssh/config line 1: Applying options for Oelkozadamdebug1: Reading configuration data /etc/ssh/ssh_configdebug2: resolving oelkozadam port 22debug2: ssh_connect_direct: needpriv 0debug1: Connecting to oelkozadam [192.168.7.145] port 22.debug1: Connection established.debug1: identity file /home/alagris/.ssh/test type 1debug1: key_load_public: No such file or directorydebug1: identity file /home/alagris/.ssh/test-cert type -1debug1: Enabling compatibility mode for protocol 2.0debug1: Local version string SSH-2.0-OpenSSH_7.3debug1: Remote protocol version 2.0, remote software version OpenSSH_7.3debug1: match: OpenSSH_7.3 pat OpenSSH* compat 0x04000000debug2: fd 3 setting O_NONBLOCKdebug1: Authenticating to oelkozadam:22 as 'alagris'debug3: send packet: type 20debug1: SSH2_MSG_KEXINIT sentdebug3: receive packet: type 20debug1: SSH2_MSG_KEXINIT receiveddebug2: local client KEXINIT proposaldebug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nist    p521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,dif    fie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-cdebug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openss    h.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.    com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed2551    9,rsa-sha2-512,rsa-sha2-256,ssh-rsadebug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.c    om,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,3des-cbcdebug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.c    om,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,3des-cbcdebug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sh    a2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,h    mac-sha2-512,hmac-sha1debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sh    a2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,h    mac-sha2-512,hmac-sha1debug2: compression ctos: none,zlib@openssh.com,zlibdebug2: compression stoc: none,zlib@openssh.com,zlibdebug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug2: peer server KEXINIT proposaldebug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nist    p521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,dif    fie-hellman-group14-sha256,diffie-hellman-group14-sha1debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.c    om,aes256-gcm@openssh.comdebug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.c    om,aes256-gcm@openssh.comdebug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sh    a2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,h    mac-sha2-512,hmac-sha1debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sh    a2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,h    mac-sha2-512,hmac-sha1debug2: compression ctos: none,zlib@openssh.comdebug2: compression stoc: none,zlib@openssh.comdebug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug1: kex: algorithm: curve25519-sha256@libssh.orgdebug1: kex: host key algorithm: ecdsa-sha2-nistp256debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: nonedebug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: nonedebug3: send packet: type 30debug1: expecting SSH2_MSG_KEX_ECDH_REPLYdebug3: receive packet: type 31debug1: Server host key: ecdsa-sha2-nistp256 SHA256:LOy/ttmSoIpf6+H0jRYCVveaNrhjTRDV61fCx6CQxQ4The authenticity of host 'oelkozadam (192.168.7.145)' can't be established.ECDSA key fingerprint is SHA256:LOy/ttmSoIpf6+H0jRYCVveaNrhjTRDV61fCx6CQxQ4.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'oelkozadam,192.168.7.145' (ECDSA) to the list of known hosts.debug3: send packet: type 21debug2: set_newkeys: mode 1debug1: rekey after 134217728 blocksdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug3: receive packet: type 21debug2: set_newkeys: mode 0debug1: rekey after 134217728 blocksdebug1: SSH2_MSG_NEWKEYS receiveddebug2: key: /home/alagris/.ssh/test (0x55ad2b5b8360), explicit, agentdebug3: send packet: type 5debug3: receive packet: type 7debug1: SSH2_MSG_EXT_INFO receiveddebug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>debug3: receive packet: type 6debug2: service_accept: ssh-userauthdebug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug3: send packet: type 50debug3: receive packet: type 53debug3: input_userauth_bannerWelcome to Oelkozadam's remote workstation. Intruders are not so welcome.debug3: receive packet: type 51debug1: Authentications that can continue: publickeydebug3: start over, passed a different list publickeydebug3: preferred publickey,keyboard-interactive,passworddebug3: authmethod_lookup publickeydebug3: remaining preferred: keyboard-interactive,passworddebug3: authmethod_is_enabled publickeydebug1: Next authentication method: publickeydebug1: Offering RSA public key: /home/alagris/.ssh/testdebug3: send_pubkey_testdebug3: send packet: type 50debug2: we sent a publickey packet, wait for replydebug3: receive packet: type 51debug1: Authentications that can continue: publickeydebug2: we did not send a packet, disable methoddebug1: No more authentication methods to try.Permission denied (publickey).    These are the permissions:chmod 700 ~/.sshchmod 644 ~/.ssh/authorized_keyschown alagris:users ~/.ssh/authorized_keysI have generated keys with this command:ssh-keygen -b 3072 -f ~/.ssh/$key -P $pass -C $(whoami)@$(hostname)-$(date -I)and used cat to append public key to ~/.ssh/authorized_keys~/.ssh/config looks as follows:Host Oelkozadam   IdentitiesOnly yes   IdentityFile ~/.ssh/test/etc/ssh/sshd_config looks as follows:Port 22AddressFamily anyListenAddress 192.168.7.145AllowUsers remote_user alagrisPermitRootLogin noBanner /my/config/SSH_ServerBannerPasswordAuthentication noChallengeResponseAuthentication noAuthorizedKeysFile      ~/.ssh/authorized_keysChallengeResponseAuthentication noUsePAM yesSubsystem       sftp    /usr/lib/ssh/sftp-server    PrintMotd no$systemctl edit sshd.socket looks as follows:[Socket]ListenStream=ListenStream=22I have no idea what else I could to make it work. I also tried to SSH from my Mac laptop via LAN but I get similar results.(edit:I removed all files in ~/.ssh and generated test and test.pub from scratch, added test.pub to ~/.ssh/authorized_keys,once again set permissions on all these files, rebooted computer, ran eval $(ssh-agent)ssh-add ~/.ssh/testand connected again. The output slightly changed. Now it says:Offering RSA public key: /home/alagris/.ssh/testThe previous:Offering RSA public key: /my/config/SSH/testwas probably fault of some unapplied changes which got updated after reboot.Also, an interesting fact is that as I recreated authorized_keys file, the key that I generated for my Mac computer was lost and yet the output of ssh connection is absolutely the same. It's very similar to output on local machine but the end:send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 51 debug1: Authentications that can continue: publickey debug1: Trying private key: /Users/alagris/.ssh/id_dsa debug3: no such identity: /Users/alagris/.ssh/id_dsa: No such file or directory debug1: Trying private key: /Users/alagris/.ssh/id_ecdsa debug3: no such identity: /Users/alagris/.ssh/id_ecdsa: No such file or directory debug1: Trying private key: /Users/alagris/.ssh/id_ed25519 debug3: no such identity: /Users/alagris/.ssh/id_ed25519: No such file or directory debug2: we did not send a packet, disable method debug1: No more authentication methods to try. Permission denied (publickey). )PS. I wish I could see any logs coming directly from server but it seems on ArchLinux there are no files like /var/log/auth.log. I can olny view journalctl which seems to be quite empty.
SSH to localhost server
ssh;sshd;openssh
I have no idea what happened. I kind of gave up but then after a few reboots it just magically started working.