Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Setting up SSH access on local machine for a project.

When I ssh -v localhost my connection gets refused. With the following stack-trace.

OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /Users/Kyle.Welsby/.ssh/config
debug1: Applying options for localhost
debug1: Applying options for *
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file /Users/Kyle.Welsby/.ssh/identity type -1
debug1: identity file /Users/Kyle.Welsby/.ssh/id_rsa type 1
debug1: identity file /Users/Kyle.Welsby/.ssh/id_dsa type -1
ssh_exchange_identification: Connection closed by remote host

My ssh configuration is the standard Mac OS X setup. With the following alterations.

# /etc/sshd_config
PermitUserEnvironment yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

# ~/.ssh/config
Host localhost
User Kyle.Welsby
share|improve this question

migrated from Feb 5 '11 at 15:37

This question came from our site for professional and enthusiast programmers.

what does your authorization server log say? It would be in /var/log/auth.log in Linux, not sure about Mac OS. Also, shouldn't AuthorizedKeysFile say %h/.ssh/authorized_keys ? – Piskvor Feb 3 '11 at 16:45
the issue happend to be PermitUserEnvironment yes commented this out and all worked fine-ish. – halfcube Feb 4 '11 at 14:38
You outlined the solution yourself. So post your solution as answer and accept it. Did you really use IPv6 for that localhost connection? – Nils Jan 12 '12 at 22:03
up vote 0 down vote accepted

The issue happened to be PermitUserEnvironment yes I commented this out and all worked fine-ish.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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