Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I recently made changes to my EC2/Ubuntu instances by installing OpenSSH, before I was able to SSH just fine, however now I'm getting this error:

ssh: connect to host shopious.com port 22: Connection refused

Any idea why? Here's what it says:

OpenSSH_5.9p1, OpenSSL 0.9.8y 5 Feb 2013
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to mysite.com [54.251.103.225] port 22.
debug1: connect to address 54.251.103.225 port 22: Connection refused
ssh: connect to host mysite.com port 22: Connection refused
share|improve this question
    
Run SSH in verbose mode (-vvv) to generate some meaningful error messages... –  jasonwryan Jun 28 at 4:53
    
@jasonwryan added more details –  adit Jun 28 at 5:13
1  
"Connection refused" most likely means there isn't anything listening on that port. The SSH server might not have been started, might be misconfigured, or might be listening on a different port. I'm confused though; are you saying the issue occured when you installed OpenSSH? –  lk- Jun 28 at 5:37
    
@Ik yes that is correct, and now I can't get into my own machine –  adit Jun 28 at 6:23

2 Answers 2

"Connection refused" is a very clear message. It means the server itself is running. But no service is bound to the given port.

In your case the machine is not running an ssh deamon or it is configured to listen on a different port.

share|improve this answer
    
so then how can I start ssh or the ssh deamon if I can't ssh to it? –  adit Jun 28 at 6:39
    
You need physical access or some kind of external management interface. In case of EC2 there seems to be a management console for that. –  michas Jun 28 at 6:44
    
I am currently in my management console, but I don't see any option on starting ssh anywhere –  adit Jun 28 at 6:47
    

If you can connect without SSH, log in and then activate SSH for this session using:

sudo service sshd start

and if you want this to be always done after reboot for example use

sudo update-rc.d sshd defaults

it will add sshd as a service.

share|improve this answer

Your Answer

 
discard

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.