1
I'm trying to ssh from my mac laptop to my linux desktop.
I ran ifconfig
on my linux desktop (the target machine) and got the ip address listed under eth0 (the machine is connected via wire - not wirelessly) next to "inet addr:"
I used this ip address in a ping command from my mac, which works as expected.
But when I then try to ssh to the machine using the same address I'm unable to reach the machine:
$ ssh -A 172.28.11.243
ssh: connect to host 172.28.11.243 port 22: Connection refused
i've googled a bit about what to check next but i'm unclear about what to do. Any pointers would be appreciated.
update 1:
$service ssh status
ssh stop/waiting
Update 2:
$ps -eaf | grep sshd
rabdelaz 23832 8389 0 10:53 pts/1 00:00:00 grep sshd
Starting Over:
$ifconfig
eth0 Link encap:Ethernet HWaddr 68:05:ca:16:c6:da
inet addr:172.28.11.243 Bcast:172.28.11.255 Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:26758 errors:0 dropped:0 overruns:0 frame:0
TX packets:12721 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5683822 (5.6 MB) TX bytes:2044745 (2.0 MB)
Memory:f71c0000-f71e0000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:22 errors:0 dropped:0 overruns:0 frame:0
TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1476 (1.4 KB) TX bytes:1476 (1.4 KB)
$service ssh status
ssh stop/waiting
$sudo service ssh start
ssh stop/pre-start, process 2961
$service ssh status
ssh stop/waiting
$grep Port /etc/ssh/ssh_config
# Port 22
Output of the logs:
$sudo grep -i ssh /var/log/*log
[sudo] password for rabdelaz:
/var/log/auth.log:Sep 9 11:17:21 bos-lpwy9 sudo: rabdelaz : TTY=pts/0 ; PWD=/home/rabdelaz/workspace/configurations ; USER=root ; COMMAND=/usr/bin/ssh-add /home/rabdelaz/.ssh/deployed/2013-07-29
/var/log/auth.log:Sep 9 11:18:12 bos-lpwy9 sudo: rabdelaz : TTY=pts/0 ; PWD=/home/rabdelaz/workspace/configurations ; USER=root ; COMMAND=/usr/bin/ssh-add /home/rabdelaz/.ssh/deployed/2013-07-29
/var/log/auth.log:Sep 9 11:29:41 bos-lpwy9 sudo: rabdelaz : TTY=pts/0 ; PWD=/home/rabdelaz/workspace/configurations ; USER=root ; COMMAND=/usr/bin/ssh-add /home/rabdelaz/.ssh/deployed/2013-07-29
/var/log/auth.log:Sep 9 11:30:58 bos-lpwy9 sudo: rabdelaz : TTY=pts/0 ; PWD=/home/rabdelaz/workspace/configurations ; USER=root ; COMMAND=/bin/chmod 777 /home/rabdelaz/.ssh/deployed/2013-07-29
/var/log/auth.log:Sep 9 11:52:04 bos-lpwy9 sudo: rabdelaz : TTY=pts/0 ; PWD=/home/rabdelaz ; USER=root ; COMMAND=/bin/chmod 777 /home/rabdelaz/.ssh/deployed/2013-07-29
/var/log/auth.log:Sep 9 12:01:42 bos-lpwy9 sudo: rabdelaz : TTY=pts/0 ; PWD=/home/rabdelaz ; USER=root ; COMMAND=/bin/ls -lha /home/rabdelaz/.ssh/deployed/2013-07-29
/var/log/auth.log:Sep 9 12:04:18 bos-lpwy9 sudo: rabdelaz : TTY=pts/0 ; PWD=/home/rabdelaz ; USER=root ; COMMAND=/bin/chmod 777 /home/rabdelaz/.ssh/internal/2013-07-29
/var/log/auth.log:Sep 9 12:04:21 bos-lpwy9 sudo: rabdelaz : TTY=pts/0 ; PWD=/home/rabdelaz ; USER=root ; COMMAND=/bin/chmod 777 /home/rabdelaz/.ssh/external/2013-07-29
/var/log/auth.log:Sep 9 12:04:39 bos-lpwy9 sudo: rabdelaz : TTY=pts/0 ; PWD=/home/rabdelaz ; USER=root ; COMMAND=/bin/chmod 777 /home/rabdelaz/.ssh/internal/2013-07-29
/var/log/auth.log:Sep 11 11:54:01 bos-lpwy9 sudo: rabdelaz : TTY=pts/2 ; PWD=/home/rabdelaz/workspace ; USER=root ; COMMAND=/usr/sbin/sshd
/var/log/auth.log:Sep 11 11:54:12 bos-lpwy9 sudo: rabdelaz : TTY=pts/2 ; PWD=/home/rabdelaz/workspace ; USER=root ; COMMAND=/usr/sbin/sshd
/var/log/auth.log:Sep 11 11:54:20 bos-lpwy9 sudo: rabdelaz : TTY=pts/2 ; PWD=/home/rabdelaz/workspace ; USER=root ; COMMAND=/usr/sbin/sshd start
/var/log/auth.log:Sep 11 11:54:54 bos-lpwy9 sudo: rabdelaz : TTY=pts/2 ; PWD=/home/rabdelaz/workspace ; USER=root ; COMMAND=/usr/sbin/service ssh start
/var/log/auth.log:Sep 11 13:36:11 bos-lpwy9 sudo: rabdelaz : TTY=pts/0 ; PWD=/home/rabdelaz/workspace/automation ; USER=root ; COMMAND=/usr/bin/apt-get install libdbi-perl libdate-calc-perl libdbd-mysql-perl libxml-easyobj-perl libdbd-pg-perl libnetaddr-ip-perl libjson-perl libconfig-json-perl libio-pty-perl libnet-ssh-perl libtext-diff-perl libwww-mechanize-perl libtext-csv-perl p4perl libxml-simple-perl liblog-log4perl-perl libyaml-libyaml-perl libdevel-stacktrace-perl libexception-class-perl libdatetime-perl libtest-deep-perl libperl-critic-perl
/var/log/auth.log:Sep 11 14:02:12 bos-lpwy9 sudo: rabdelaz : TTY=pts/0 ; PWD=/home/rabdelaz/workspace/automation ; USER=root ; COMMAND=/usr/bin/cpan httpssh
/var/log/auth.log:Sep 12 10:56:31 bos-lpwy9 sudo: rabdelaz : TTY=pts/1 ; PWD=/home/rabdelaz/workspace/automation ; USER=root ; COMMAND=/usr/sbin/service ssh start
/var/log/auth.log:Sep 12 11:13:19 bos-lpwy9 sudo: rabdelaz : TTY=pts/1 ; PWD=/home/rabdelaz/workspace/automation ; USER=root ; COMMAND=/usr/sbin/service ssh start
/var/log/auth.log:Sep 12 11:13:23 bos-lpwy9 sudo: rabdelaz : TTY=pts/1 ; PWD=/home/rabdelaz/workspace/automation ; USER=root ; COMMAND=/usr/sbin/service ssh start
/var/log/auth.log:Sep 12 11:15:46 bos-lpwy9 sudo: rabdelaz : TTY=pts/1 ; PWD=/home/rabdelaz/workspace/automation ; USER=root ; COMMAND=/usr/sbin/service sshd start
/var/log/auth.log:Sep 12 11:26:40 bos-lpwy9 sudo: rabdelaz : TTY=pts/1 ; PWD=/home/rabdelaz/workspace/automation ; USER=root ; COMMAND=/usr/sbin/service ssh start
/var/log/auth.log:Sep 12 11:55:29 bos-lpwy9 sudo: rabdelaz : TTY=pts/0 ; PWD=/home/rabdelaz/workspace ; USER=root ; COMMAND=/bin/grep -i ssh /var/log/auth.log /var/log/boot.log /var/log/centrifydc-install.log /var/log/centrify_mapper_error.log /var/log/daemon.log /var/log/dpkg.log /var/log/faillog /var/log/fontconfig.log /var/log/jockey.log /var/log/kern.log /var/log/lastlog /var/log/lpr.log /var/log/mail.log /var/log/pm-powersave.log /var/log/pycentral.log /var/log/syslog /var/log/ufw.log /var/log/user.log /var/log/Xorg.0.log
/var/log/dpkg.log:2013-09-11 13:36:18 install libnet-ssh-perl <none> 0.09-1
/var/log/dpkg.log:2013-09-11 13:36:18 status half-installed libnet-ssh-perl 0.09-1
/var/log/dpkg.log:2013-09-11 13:36:18 status half-installed libnet-ssh-perl 0.09-1
/var/log/dpkg.log:2013-09-11 13:36:18 status unpacked libnet-ssh-perl 0.09-1
/var/log/dpkg.log:2013-09-11 13:36:18 status unpacked libnet-ssh-perl 0.09-1
/var/log/dpkg.log:2013-09-11 13:36:24 configure libnet-ssh-perl 0.09-1 0.09-1
/var/log/dpkg.log:2013-09-11 13:36:24 status unpacked libnet-ssh-perl 0.09-1
/var/log/dpkg.log:2013-09-11 13:36:24 status half-configured libnet-ssh-perl 0.09-1
/var/log/dpkg.log:2013-09-11 13:36:24 status installed libnet-ssh-perl 0.09-1
make sure that open ssh is installed in your remote machine – Ashildr – 2013-09-12T14:48:09.477
make sure that you arent blocking your connection with iptables or some other firewall. also make sure that you have the program running as DEFCON said and that it is running on 22 not some other port (should be, it's the standard, but it's worth looking up.) – PsychoData – 2013-09-12T14:49:33.270
Is that really your computer's internal IP? It looks like an external one. WHat is the output of
service ssh status
on the linux box? – terdon – 2013-09-12T14:50:47.973Or you can do
ps -eaf|grep sshd
to check if you have a ssh daemon running. – Rik – 2013-09-12T14:52:18.013@terdon - posted the output of
service ssh status
. looks like it's not running? @Rik - that grep doesn't return anything but the grep itself. – Ramy – 2013-09-12T14:54:13.6302Just run
sudo service ssh start
and then try to connect again. Let us know if this does not persist after a reboot. – terdon – 2013-09-12T14:56:14.233i ran sudo
service ssh start
, but was still unable to ssh to the remote machine. I've restarted the machine and the service is once again stopped. – Ramy – 2013-09-12T15:05:59.393OK, start over. Please run these commands in order and add their output to your question.
ifconfig
,service ssh status
,sudo service ssh start
,service ssh status
, and then try to connect and give us the output again. If it still does not work, also post the output ofgrep Port /etc/ssh/ssh_config
. In all cases, include the exact error (not "did not work") . – terdon – 2013-09-12T15:23:47.060posted the sequence of commands and output – Ramy – 2013-09-12T15:31:00.403
Do you have more than 1 eth device on the linux box? Have you made any changes to the default routing on either machine? Double check the IP is correct and that SSH is running on the default port. Also check you didn't include an option to use keys with your SSH connections. – Gary Morris – 2013-09-12T14:53:47.487