Page 1 of 1

SSH: suddently can't connect to any host

Posted: 12 Jan 2016, 16:38
by datruche
Hi,
I've been using Porteus for a few months on a low-profile netbook, ssh'ed every day to my other (distant) systems with great success. Key-based / passsword auth and X11 forwarding worked.
Using ~/.ssh/config to automatise my workflow. Have yet to configure keychain-like, meanwhile have been using ssh-agent & ssh-add before launching with ServerAlive* and ControlMaster/Persist with socket.

In case it's linked, two days ago I installed x2Go and generated a RSA key (x2Go does not handle ed25519 keys), then copied the id_rsa (pub) to one of my servers, and added it to the known_hosts file. Also I had to install & launch sshd (with a custom port) for x2Go.
Since then ssh has stopped to "work".

ssh <hostname> expires after minutes with no related log on the servers (I can access the later from my smartphone and tablet)

ssh -vvv -pPORT myuser@hostX

Code: Select all

OpenSSH_6.7p1, OpenSSL 1.0.1j 15 Oct 2014
debug1: Reading configuration data /home/kozaki/.ssh/config
debug1: /home/kozaki/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to <host_alias> [<host_IP>] port <PORT>
<Go make a call, make cofee or something>
debug1: connect to address 90.62.206.176 port 1437: Connection timed out
ssh: connect to host llewellyn.zapto.org port 1437: Connection timed out
can't connect either.
Reverted ~/.ssh/ content to what it was before adding the RSA encrypted key and the line in know_hosts ; yet ssh times out. Same if I move the whole ~/.ssh folder's content and try to connect 100% manually w/password auth. Each time the server shows no sign of activity, like when you've lost the network connection or typed the wrong IP or there's no running ssh server on the host (here they are running).

Tested if I can access every other systems from one another, and yes, I can each time, but from Porteus.

Please help as I'm out of luck trying to debug that one :crazy:

EDIT: clarified the one-before-the-last phrase.

Re: SSH: suddently can't connect to any host

Posted: 12 Jan 2016, 20:21
by brokenman
What are the permissions on said .ssh folder and files?

Re: SSH: suddently can't connect to any host

Posted: 12 Jan 2016, 20:36
by datruche
Thanks brokenman

kozaki@porteus:~$ ls -dl ~/.ssh && ll ~/.ssh/

Code: Select all

drwx------ 2 kozaki kozaki 154 Jan 12 17:15 .ssh/
total 36
-rw-r--r-- 1 kozaki kozaki  133 Dec 27 00:32 agent.env
-rw-r--r-- 1 kozaki kozaki 2487 Jan 12 14:39 config
-rw------- 1 kozaki kozaki  464 Dec  5 20:00 id_curve25519
-rw-r--r-- 1 kozaki kozaki  106 Dec  5 20:00 id_curve25519.pub
-rw------- 1 kozaki kozaki 3326 Jan 10 23:03 id_rsa_compat
-rw-r--r-- 1 kozaki kozaki  751 Jan 10 23:03 id_rsa_compat.pub
-rw-r--r-- 1 kozaki kozaki 2058 Jan 12 03:37 known_hosts
I had this covered (I think).

Re: SSH: suddently can't connect to any host

Posted: 13 Jan 2016, 00:17
by brokenman
Looks good. Anything on the target machine at /var/log/secure?
Also try adding StrictModes off to your ssh_config file

On the porteus machine try:
chmod 700 /home/kozaki

Also double check your target port and firewall on porteus.

Re: SSH: suddently can't connect to any host

Posted: 13 Jan 2016, 01:22
by datruche
brokenman wrote:On the porteus machine try:
chmod 700 /home/kozaki
Now that you points it out,
$ ll /home/

Code: Select all

total 8
drwxr-xr-x 23 guest guest 4096 Jan 12 03:22 guest/
drwxr-xr-x 24 root  root  4096 Jan 12 16:08 kozaki/
# find /home/kozaki -user root

Code: Select all

/home/kozaki/.cache
/home/kozaki/.cache/sessions
/home/kozaki/.cache/mozilla
/home/kozaki/.cache/mozilla/firefox
/home/kozaki/.cache/mozilla/firefox/xnxnxnxnxn.default
/home/kozaki/.cache/mozilla/firefox/xnxnxnxnxn.default/thumbnails
find: `/home/kozaki/.cache/moonchild productions/pale moon/xnxnxnxnxn.default/thumbnails/db2e258a61b7a134d0b9c9d62de48711.png': Input/output error
find: `/home/kozaki/.cache/moonchild productions/pale moon/xnxnxnxnxn.default/thumbnails/31805711e216f3e4e2da3790f3b5226e.png': Input/output error
find: `/home/kozaki/.cache/moonchild productions/pale moon/xnxnxnxn.default/thumbnails/bbd425470538a44fbc0e6e85081c627f.png': Input/output error
<SNIP>
/home/kozaki/.local
/home/kozaki/.local/share
/home/kozaki/.local/share/gvfs-metadata
/home/kozaki/.local/share/Trash
/home/kozaki/.local/share/Trash/files
/home/kozaki/.local/share/Trash/info
/home/kozaki/.mozilla
/home/kozaki/.mozilla/firefox
/home/kozaki/.mozilla/firefox/xnxnxnxnxn.default
/home/kozaki/.mozilla/firefox/xnxnxnxnxn.default/sessionstore-backups
/home/kozaki/.mozilla/firefox/xnxnxnxnxn.default/gmp-gmpopenh264
/home/kozaki/.mozilla/firefox/xnxnxnxnxn.default/weave
/home/kozaki/.mozilla/firefox/xnxnxnxnxn.default/weave/logs
/home/kozaki/.thumbnails
/home/kozaki/.thumbnails/normal
/home/kozaki/.thumbnails/large
/home/kozaki/.macromedia
/home/kozaki/.macromedia/Flash_Player
/home/kozaki/.macromedia/Flash_Player/#SharedObjects
/home/kozaki/.macromedia/Flash_Player/#SharedObjects/Z2AZ4ZHZ
find: `/home/kozaki/.moonchild productions/pale moon/xnxnxnxnxn.default/bookmarkbackups/bookmarks-2016-01-05.json': Input/output error
find: `/home/kozaki/.moonchild productions/pale moon/xnxnxnxnxn.default/bookmarkbackups/bookmarks-2016-01-04.json': Input/output error
<SNIP>
See that ? :shock:
Whether related or not, this super smart auto `chown root:root` on part of my user's $HOME happens after rebooting since I duplicated porteus to a new and faster Sandisk stick. Porteus also reverts to the 'en_US' keyboard layouts (in tty and X), that is whatever chown/setting I do (and kmap cheatcode on porteus.cfg). Today ,and maybe yesterday, I forgot to check and correct the permissions upon boot-up... as for the I/O erros on Palemoon/, I runned a fsck.vfat yesterday and the second output was good. Reverting to the initial issue.

# find /home/kozaki -user root -exec chown kozaki:kozaki {} \;
then
$ ssh -vvv -pPORT myuser@hostX
gives another connexion timeout without a string appearing in the host's journalctl -xe :o
Main hosts are up-to-date Arch, so no /var/log/secure. Another is an android that I have no f****in idea where to look for sec logs. whosh, big hole in my ability to debug, and shows how much I consume this little device.

'StrictMode /etc/ssh/sshd_config' (and firewall) on the hosts you mean?
I do connect as usual to the other boxes but from the Porteus box. Also I did touch Porteus system settings (x2go, sshd), not the three other hosts, since before this ssh sudden breakdown. Therefore I doubt any change I'll do on the servers will help resolve, but it may help further debugging.

Also tried to connect Wi-Fi to my other router (that the tablet uses), with no effects.

Re: SSH: suddently can't connect to any host

Posted: 13 Jan 2016, 18:50
by datruche
I tried as the guest user, and got the connection timeout. I was connected to these servers from another system. 'Guest' had no .ssh folder, nor ever had a sub-normal 'auto chown root' on his $HOME as my user. That's another point on the on the debugging list:

* anything server side (since I can connect there from any other client than Porteus)
* network (since I can connect from my phone to another box on the same LAN)
* ssh client configuration (since ssh worked until Jan. 10th, and last edit of /etc/ssh/ssh_config is back to October 2015, and Guest user has the same issue without any ssh customisation)

Newly modified files in /etc (look at passwd* and group* sizes):

Code: Select all

-rw-r--r--  1 0    0 6,6K janv.  6 13:32 smartd.conf~
-rw-r--r--  1 0    0 6,7K janv.  6 14:00 smartd.conf
drwxr-xr-x  3 0    7   16 janv.  9 02:36 cups/
drwxr-xr-x  7 0    0   29 janv.  9 03:07 gconf/
drwxr-xr-x  2 0    0   30 janv.  9 14:03 profile.d/
drwxr-xr-x  2 0    0 4,0K janv. 13 00:48 usm/
lrwxrwxrwx  1 0    0   32 janv. 13 18:09 localtime-copied-from -> /usr/share/zoneinfo/Europe/Paris
-rw-r--r--  1 0    0 3,0K janv. 13 18:09 localtime
-rw-r--r--  1 0    0  122 janv. 13 18:09 hardwareclock
drwxrwxrwx 76 0    0  280 janv. 13 18:09 ../
drwxr-xr-x  2 0    0   60 janv. 13 18:09 lxdm/
-rw-------  1 0    0  512 janv. 13 18:09 random-seed
drwxr-xr-x  2 0    0  260 janv. 13 18:09 ssh/
-rw-r--r--  1 0    0   45 janv. 13 18:09 adjtime
-rw-r--r--  1 0    0   76 janv. 13 18:09 resolv.conf
-rw-r--r--  1 0    0 1,5K janv. 13 18:13 fstab
-rw-r--r--  1 0    0   19 janv. 13 19:33 shadow
drwxr-xr-x 12 0    0   30 janv. 13 19:33 rc.d/
-rw-r--r--  1 0    0   21 janv. 13 19:33 passwd
-rw-r--r--  1 0    0   14 janv. 13 19:33 group
-rw-r--r--  1 0    0  612 janv. 13 19:34 mtab
-rw-r--r--  1 0    0  63K janv. 13 19:37 ld.so.cache
cat /etc/{passwd,group}

Code: Select all

sshd:x:33:33:sshd:/:
sshd::33:sshd
Hey, WTH is that?