I created EC2 Ubuntu Instance, when the status check was clear, I tried following command.  chmod -400 key.pem  &amp;  ssh -i key.pem ubuntu@ip_address  which gave following error  ssh: connect to host ip_address port 22: Connection refused  Then I tried rebooting the Instance but the error was still there.I tried   telnet ip_address 22  which gave me the same error  telnet: Unable to connect to remote host: Connection refused  I already follwed  and    following links but none worked:  Please tell me how do I resolve this.
18
This is a  about Connection Refused    We see a lot of questions to the effect      When I try to connect to a system I get a message      Connection refused      Why is this ?
46725
I'm using Ubuntu server 10.04.   ssh-add /foo/cert.pem gave the following output:     Could not open a connection to your   authentication agent.   These are my running processes:  ps -aux | grep ssh Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html root      1523  0.0  0.0  49260   632 ?        Ss   Dec25   0:00 /usr/sbin/sshd root     10023  0.0  0.3 141304  6012 ?        Ss   12:58   0:00 sshd: padmin [priv] padmin   10117  0.0  0.1 141304  2400 ?        S    12:58   0:00 sshd: padmin@pts/1 padmin   11867  0.0  0.0   7628   964 pts/1    S+   13:06   0:00 grep --color=auto ssh root     31041  0.0  0.3 141264  5884 ?        Ss   11:24   0:00 sshd: padmin [priv] padmin   31138  0.0  0.1 141264  2312 ?        S    11:25   0:00 sshd: padmin@pts/0 root     31382  0.0  0.3 139240  5844 ?        Ss   11:26   0:00 sshd: padmin [priv] padmin   31475  0.0  0.1 139372  2488 ?        S    11:27   0:00 sshd: padmin@notty padmin   31476  0.0  0.0  12468   964 ?        Ss   11:27   0:00 /usr/lib/openssh/sftp-server   These are my environment variables:  $ env | grep SSH SSH_CLIENT=192.168.1.13 42626 22 SSH_TTY=/dev/pts/1 SSH_CONNECTION=192.168.1.13 42626 192.168.1.2 22   What is wrong? Why can't I add any identities?
19823
Possible Duplicate:          I frequently connect to amazon ec2 using their public DNS names (ec2-12-34-56-78.compute-1.amazonaws.com) and because of this my known_hosts file gets overwhelmed with a lot of ec2 entries I will never use again.  I know I could probably use sed -i to edit in place but I wanted to use grep and so I did this:  grep -v ec2 ~/.ssh/known_hosts &gt; ~/.ssh/known_hosts   That leaves known_hosts as an empty file. If I do:  grep -v ec2 ~/.ssh/known_hosts &gt; ~/.ssh/tmp mv ~/.ssh/tmp ~/.ssh/known_hosts   then things are fine, but I am confused why reading and writing to the same file leaves it blank, and if there is any way around this when using grep, cat, etc.
100031
I have a little VPS I run apache and a Minecraft server on. I don't ever turn it off, but should I restart it for some reason, IPTables blocks most of my ports, including port 80. I've tried so many different suggestions on fixing this, but with no luck. Also, since the provider is OVH, the support is... lacking.  So, I've created a workaround, which I'm happy with. I created a simple shell script file to open certain ports I need opened on restart (80 and 25565 for now). The important ones such as 21 and 22 are not affected on restart.   The script looks like this:  iptables -I INPUT -p tcp --dport 80 -j ACCEPT iptables -I INPUT -p udp --dport 80 -j ACCEPT iptables -I INPUT -p tcp --dport 25565 -j ACCEPT iptables -I INPUT -p udp --dport 25565 -j ACCEPT /sbin/service iptables save   When I manually run it by typing /iptdef.sh, it runs fine, the ports become open and it's all good.  Of course, it's not practical having to remember to run it every time I restart the server, so I added a crontab. The problem is, it doesn't work/run. This is my crontab file:  */5 * * * * /backup2.sh */55 * * * * /backup3.sh @reboot /iptdef.sh * * * * *  /iptdef.sh   The first two lines work. They are just simple scripts that make a backup of a folder for me. The second two lines are what's not working.   Is there a chance that perhaps it's not possible to run iptables commands from a cron? It sounds silly, but I can't see any other reason for it not to work. The scripts have the correct permissions.
29921
Here's my situation: I'm setting up a test harness that will, from a central client, launch a number of virtual machine instances and then execute commands on them via ssh.  The virtual machines will have previously unused hostnames and IP addresses, so they won't be in the ~/.ssh/known_hosts file on the central client.  The problem I'm  having is that the first ssh command run against a new virtual instance always comes up with an interactive prompt:  The authenticity of host '[hostname] ([IP address])' can't be established. RSA key fingerprint is [key fingerprint]. Are you sure you want to continue connecting (yes/no)?   Is there a way that I can bypass this and get the new host to be already known to the client machine, maybe by using a public key that's already baked into the virtual machine image ?  I'd really like to avoid having to use Expect or whatever to answer the interactive prompt if I can.
42783
I just installed Ubuntu 14.04 on my server and I was setting up all my config files when I came across this in my sshd_config file:  # Authentication: LoginGraceTime 120 PermitRootLogin without-password StrictModes yes   This made me very worried. I thought that it was possible that someone could be logging into my server as root without a password.  I tried connecting to my server as root via:  johns-mbp:~ john$ ssh root@192.168.1.48 The authenticity of host '192.168.1.48 (192.168.1.48)' can't be established. RSA key fingerprint is 40:7e:28:f1:a8:36:28:da:eb:6f:d2:d0:3f:4b:4b:fe. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.1.48' (RSA) to the list of known hosts. root@192.168.1.48's password:     I entered a blank password and it didn't let me in, which was a relief. So my question is: what does without password mean and why is this a default in Ubuntu 14.04?
16055
There is a list of IP addresses in a .txt file, ex.:  1.1.1.1 2.2.2.2 3.3.3.3   Behind every IP address there is a server, and on every server there is an sshd running on port 22. Not every server is in the known_hosts list (on my PC, Ubuntu 10.04 LTS/bash).  How can I run commands on these servers, and collect the output?  Ideally, I'd like to run the commands in parallel on all the servers.  I'll be using public key authentication on all the servers.  Here are some potential pitfalls:   The ssh prompts me to put the given servers ssh key to my known_hosts file. The given commands might return a nonzero exit code, indicating that the output is potentially invalid. I need to recognize that. A connection might fail to be established to a given server, for example because of a network error. There should be a timeout, in case the command runs for longer than expected or the server goes down while running the command.   The servers are AIX/ksh (but I think that doesn't really matter.
21917
I am working with some Amazon EC2 servers that are up and running, and I need to SSH into the servers. I don't have any keys that were generated when the servers were first set up (someone else did it long before I got here). Can I still get into the servers without the key files?  FWIW I've tried a lot of things to SSH into the box so far, including generating new key pairs in the EC2 dashboard, and nothing seems to be working.  and  seem to indicate that I'm out of luck unless I want to make an AMI of my current server and then use it to instantiate a whole new EC2 server instance (just to get the .pem file generated at that time). Is that really the only way I can get into the box at this point?!
67640
The server works fine via the Amazon assigned DNS entry, but I cannot reach it (using a browser) via the Elastic IP address Amazon assigned the box. Ping does not work either. I am trying to confirm it is reachable before I add the IP address to my own DNS entries.
44097
After a few days of operation on my new ec2 build, the following happens:   I log into SSH, everything is fine, I do my coding I return the next day, and log into SSH I cannot type a lower cased e anymore--I get the error ding when I type it I try to ssh from a different computer, same problem I reboot the server, same problem I open nano or vi and e works fine, just not in bash or sh I terminate the server, create a new one, install from scratch, a few days later it happens again   This is baffling! Where do I even start to troubleshoot?  My Local Machine Setup(s):   windows XP or 7 putty (latest) or cygwin/openssh   The EC2 setup   Amazon Linux (default options) node.js iptables forwarding port 80 to node on port 8003 emacs, npm, and openssl-devel no other mods       Output of stty -a while I can't type an e  sh-4.1$ stty -a speed 38400 baud; rows 30; columns 95; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = &lt;undef&gt;; eol2 = &lt;undef&gt;; swtch = &lt;undef&gt;; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -cdtrdsr -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke   In case it helps someone else with a similar issue, I created a script (called sub) to convert upper-cased E to lower-cased, then echo the command back. Then I run it in backticks to get an e on the command line::  #!/bin/sh echo ${@//E/e}  &gt; `sub Emacs /Etc/profilE`   UPDATES   This breaks for all users In bash only (csh works fine) In emacs edit mode only   I've created  and hone in the solution.
50682
I'm trying to telnet into port 25 on a CentOS server that runs PostFix to test sending email messages from the server.  When I try to telnet in from another CentOS box on the same network I get the message below:   Unable to connect to remote host: Connection refused   SELinux is disabled and I've opened port 25 in iptables...what else should I be looking at?
30941
My application listens on port 8180.  When I am trying to connect to port 8180 locally. Connection got refused. But when I am trying to connect to port with ip . I am able to connect.  [root@MUMLGOMAPP002 ~]# telnet 10.209.129.54 8180 Trying 10.209.129.54... Connected to MUMLGOMAPP002 (10.209.129.54). Escape character is '^]'. ^] telnet&gt; q Connection closed.   [root@MUMLGOMAPP002 ~]# telnet localhost 8180 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused telnet: Unable to connect to remote host: Connection refused   My interface is :  [root@MUMLGOMAPP002 ~]# ifconfig bond0     Link encap:Ethernet  HWaddr 44:1E:A1:73:F7:50           inet addr:10.209.129.54  Bcast:10.209.129.63  Mask:255.255.255.224           UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1           RX packets:322997568 errors:23 dropped:0 overruns:0 frame:0           TX packets:304470664 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0           RX bytes:213628580915 (198.9 GiB)  TX bytes:217449664400 (202.5 GiB)   I would like to know what is the difference between telnetting localhost and ip.
15332
I have a remote server. I planned to use public keys to connect over ssh without typing the password but the remote system rejects public key authentication.  So what is the best way to do it? What about using sshpass?
97493
I get the following prompt everytime I try to connect a server using SSH. I type "yes", but is there a way to aovid this?  The authenticity of host '111.222.333.444 (111.222.333.444)' can't be established. RSA key fingerprint is f3:cf:58:ae:71:0b:c8:04:6f:34:a3:b2:e4:1e:0c:8b. Are you sure you want to continue connecting (yes/no)?
12487
I have a script which connects to a remote host to replicate some files via SSH.  I must connect to an rsync daemon listening on port 873.  To accomplish this I have a ssh configuration like this.  Host blah     LocalForward 10873 127.0.0.1:873     Hostname 10.2.4.1   Unfortunately because of the timing of this script, there is a small chance that on occasion when it attempts to establish the SSH session another similar script will have the port open to a different host.  If I connect while another ssh session is open I get the obvious message Address already in use.  me@local:~$ ssh blah bind: Address already in use channel_setup_fwd_listener: cannot listen to port: 10873 Could not request local forwarding. Linux remote 2.6.26-2-amd64 #1 SMP Tue Jan 25 05:59:43 UTC 2011 x86_64 motd... remote:~$    What I want to have happen is to have the SSH client immediately exit with a exit code so I can put some logic into my script to report a failure instead of trying to run any commands against the port forwarded to the incorrect host.
124107
I'm having a really hard time configuring ubuntu 13.04 to have a static ip address. I have tried multiple solutions but everytime I reboot (can't do the network reset command because ubuntu freezes) I end up with no connection.  Here is what I get when i type ifconfig into the terminal:  eth0      Link encap:Ethernet  HWaddr 10:bf:48:bc:07:cb             inet addr:192.168.0.8  Bcast:192.168.0.255  Mask:255.255.255.0           inet6 addr: fe80::12bf:48ff:febc:7cb/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:1763067 errors:0 dropped:0 overruns:0 frame:0           TX packets:1024326 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:2284491220 (2.2 GB)  TX bytes:136809317 (136.8 MB)  lo        Link encap:Local Loopback             inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:65536  Metric:1           RX packets:1840 errors:0 dropped:0 overruns:0 frame:0           TX packets:1840 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:185688 (185.6 KB)  TX bytes:185688 (185.6 KB)   I have also tried this:  auto lo iface lo inet loopback auto eth0 iface eth0 inet static         address 192.168.0.160         netmask 255.255.255.0         broadcast 192.168.0.255         gateway 192.168.0.1         dns-nameservers 24.222.0.94         dns-nameservers 24.222.0.95   If anyone could help me it would be very much appreciated.
103397
Fresh install of Fedora 25 Server Server behind a router with only a few NAT-rules Many SSH login attempts from hundreds of different IPs / ports (ever-changing) Recently attacks / exploits on nginx (running in a docker instance) shows up in the log, too.   A few examples from the log:  error: maximum authentication attempts exceeded for invalid user root from 88.14.203.97 port 56548 ssh2 [preauth]  error: Received disconnect from 52.221.236.126 port 62639:3: com.jcraft.jsch.JSchException: Auth fail [preauth]  [error] 6#6: *138 open() "/usr/share/nginx/html/nice ports,/Trinity.txt.bak" failed (2: No such file or directory), client: 77.77.211.78, server: localhost, request: "GET /nice%20ports%2C/Tri%6Eity.txt%2ebak HTTP/1.0"   I went through the basic hardening measures at install, including only allowing SSH login  with a certificate (no passwords, no root).  Questions   How can the attackers reach different ports on my LAN, not configured in NAT? UPnP…? Is it possible to block / stop these blind attacks?   Additional and possibly relevant information  I use the Dynamic DNS service freedns.afraid.org with a newly registered domain name.