1

Currently, I met a problem, I cannot ssh to localhost in MacBook, but can ssh to other computers from MacBook. This is the output of the command.

    ssh -v localhost
    OpenSSH_7.6p1, LibreSSL 2.6.2
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 52: Applying options for *
    debug1: Connecting to localhost port 22.
    debug1: Connection established.
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/something/.ssh/id_rsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/something/.ssh/id_rsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/something/.ssh/id_dsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/something/.ssh/id_dsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/something/.ssh/id_ecdsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/something/.ssh/id_ecdsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/something/.ssh/id_ed25519 type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/something/.ssh/id_ed25519-cert type -1
    debug1: Local version string SSH-2.0-OpenSSH_7.6
    ssh_exchange_identification: read: Connection reset by peer
6
  • 2
    Looks like something is responding on port 22, but either it isn't an SSH server or there's a firewall that blocks the connection after seeing the content of the first packets. Are you actually running an SSH server on port 22? What is your firewall configuration? What have you changed from the default SSH and networking configurations? Commented Feb 10, 2018 at 9:00
  • Check in your sshd config (/etc/ssh/sshd_config) for any authentication-related configuration, and allowed users: some of this is preventing your authentication. Commented Feb 10, 2018 at 9:01
  • Welcome to this community. Please also take the tour. Commented Feb 10, 2018 at 10:16
  • @InterestingDroplet, Have you found any solution for this? Commented Aug 10, 2018 at 19:21
  • Potentially, there is some wrong in the /etc/ssh/sshd_config. Although I did not modify anything in the file /etc/ssh/sshd_config. @pkgajulapalli Commented Aug 12, 2018 at 12:38

1 Answer 1

0

I know this is old, but I think the proper way to handle this issue is to start sshd server manually in debug mode, listening to a different port and try to connect to this port instead of default 22.

# Start the server
sudo /usr/sbin/sshd -d -p 2222

# connect to server from another terminal
ssh -p 2222 localhost

I have encountered the same issue and spent a lot of time. Checkout this question for detailed answer.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.