2

Update I'm currently running 20.04 now. I did some more research and that your ip address is registered to a domain. You have to use actual domain instead. SSH Public key is configured for the domain. I logged on with the MTU reduced. Despite the research I still have the error.

Current Problem:

I have tried almost everything to solve this. When I run ssh root@{ip.address}. This happens Connection closed by {ip address} port 22 this error comes up. I ran sudo ss -tulpn | grep :22[Solved]

tcp   LISTEN 0      128           0.0.0.0:22         0.0.0.0:*    users:(("sshd"
tcp   LISTEN 0      128              [::]:22            [::]:*    users:(("sshd"

I've permitted the RootLogin Here's ssh -vvv {domain@example}:

 OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /home/user/.ssh/config
debug1: /home/user/.ssh/config line 1: Applying options for domain@example
debug3: kex names ok: [diffie-hellman-group1-sha1]
debug1: /home/user/.ssh/config line 4: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "domain@example" port 22
debug2: ssh_connect_direct
debug1: Connecting to domain@example [ip address] port 22.

Ran tail -n 500 /var/log/auth.log | grep ssh

user sudo: user : TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=/usr/bin/apt install openssh-server openssh-client
user useradd[17976]: new user: name=sshd, UID=128, GID=65534, home=/run/sshd, shell=/usr/sbin/nologin, from=none
user usermod[17984]: change user 'sshd' password
user chage[17991]: changed password expiry for sshd
user sshd[18118]: Server listening on 0.0.0.0 port 22.
user sshd[18118]: Server listening on :: port 22.
user sudo: user : TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=/usr/sbin/ufw allow ssh
user sudo: user : TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=/usr/bin/nano /etc/ssh/sshd_config
user polkitd(authority=local): Operator of unix-session:2 successfully authenticated as unix-user:user to gain TEMPORARY authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.212 [systemctl restart sshd.service] (owned by unix-user:user)
user sshd[18118]: Received signal 15; terminating.
user sshd[24826]: Server listening on 0.0.0.0 port 22.
user sshd[24826]: Server listening on :: port 22.
user sudo: user : TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=/usr/sbin/ufw allow ssh
user sshd[28153]: Accepted publickey for elizabeth from 127.0.0.1 port 32912 ssh2: RSA 
user sshd[28153]: pam_unix(sshd:session): session opened for user user by (uid=0)
user sshd[29442]: Connection closed by 127.0.0.1 port 50390 [preauth]
user sshd[29591]: Accepted publickey for user from 127.0.0.1 port 50548 ssh2: RSA 
user sshd[29591]: pam_unix(sshd:session): session opened for user user by (uid=0)
user sshd[29647]: Received disconnect from 127.0.0.1 port 50548:11: disconnected by user
user sshd[29647]: Disconnected from user user 127.0.0.1 port 50548
user sshd[29591]: pam_unix(sshd:session): session closed for user user sshd[28247]: Received disconnect from 127.0.0.1 port 32912:11: disconnected by user
user sshd[28247]: Disconnected from user user 127.0.0.1 port 32912
user sshd[28153]: pam_unix(sshd:session): session closed for user user user sshd[812]: Server listening on :: port 22.

Omitted ip address, my name, website and key for privacy

Confirmed I have authorized_keys.

  ls -l .ssh/authorized_keys

-rw------- 1 user user 573 Sep 10 18:06 .ssh/authorized_keys
SeemsToBeStuck
  • 145
  • 2
  • 8
  • 17
  • Hi, are you able to access the remote server in any other manner? You should have a look at the `auth.log` file (on remote server) to see if there are any obvious outputs there; `tail -n 500 /var/log/auth.log | grep ssh` Maybe also if you can, share the config file of your remote host, to see if there is something useful there. – denNorske Sep 11 '21 at 20:21
  • I tried a vpn via root which I got in but I could create user as I needed root access. – SeemsToBeStuck Sep 11 '21 at 20:55
  • Thanks, can't see anything obvious. Have you tried disabling Pubkey login and instead tried with password login to the server? When you attempt to connect, can you share logs from the sshd service on the remote host? `journalctl -u sshd -n 100` to show the last 100 lines. – denNorske Sep 11 '21 at 21:19
  • Possible bug: https://askubuntu.com/questions/1229456/ssh-fails-with-connection-timed-out-in-vpn-and-hangs-here-expecting-ssh2-msg – Terrance Sep 11 '21 at 22:20
  • Nope nothing, it try the bug. – SeemsToBeStuck Sep 11 '21 at 22:22
  • Hello @SeemsToBeStuck. Can you clarify a little bit whats done in server and whats done client? What are you running on the client. I understood server is Ubuntu 21.04 right? – jpbrain Sep 12 '21 at 17:12
  • What's the output (on the server) of `ls -l .ssh/authorized_keys`? When you say that you "authorized the `id_rsa.pub`" what do you mean? What commands did you run to achieve this? And finally: why are you trying to ssh as the root user? Enabling this is particularly insecure. – James S. Sep 12 '21 at 17:50
  • Its a one-off I'm trying to use it to create a new user. – SeemsToBeStuck Sep 12 '21 at 18:17
  • So you used ssh-copy-id, but it gave you an error? – James S. Sep 12 '21 at 19:18

0 Answers0