Eu tenho o Ubuntu 16.04 (mate) rodando no meu laptop (10.197.1.xx) e desktop (10.141.200.xxx). De qualquer um deles, consigo fazer ping no outro. Mas o ssh vaitempo esgotado(não recusa a conexão, nem dá nenhum aviso ou mensagem de erro).
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 10.197.1.xxx [10.197.1.xxx] port 22.
debug1: connect to address 10.197.1.xxx port 22: Connection timed out
ssh: connect to host 10.197.1.xxx port 22: Connection timed out
O PC e o Laptop em questão possuemservidor opensshinstalado.
$ sudo service sshd status
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
Active: active (running) since Mon 2017-04-10 09:59:50 IST; 4h 49min ago
Process: 3682 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCES
Main PID: 1096 (sshd)
CGroup: /system.slice/ssh.service
└─1096 /usr/sbin/sshd -D
Apr 10 10:37:18 H110M-DS2 systemd[1]: Reloading OpenBSD Secure Shell serve
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Received SIGHUP; restarting.
Apr 10 10:37:18 H110M-DS2 systemd[1]: Reloaded OpenBSD Secure Shell server
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Server listening on 0.0.0.0 port 22.
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Server listening on :: port 22.
Apr 10 10:37:18 H110M-DS2 systemd[1]: Reloading OpenBSD Secure Shell serve
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Received SIGHUP; restarting.
Apr 10 10:37:18 H110M-DS2 systemd[1]: Reloaded OpenBSD Secure Shell server
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Server listening on 0.0.0.0 port 22.
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Server listening on :: port 22.
O status do firewall éinativo
sudo ufw status
Status: inactive
O que pode estar errado? Como faço o ssh funcionar.
ATUALIZAR
O traceroute
programa produziu a seguinte saída
traceroute to 10.197.1.xxx (10.197.1.xxx), 30 hops max, 60 byte packets
1 router.xxx.xxxx.xx.in (10.xxx.xxx.1) 1.069 ms 1.388 ms 1.691 ms
2 10.xxx.xxx.1 (10.xxx.xxx.1) 0.820 ms 0.814 ms 0.974 ms
3 172.xx.x.1 (172.xx.x.1) 0.371 ms 0.384 ms 0.375 ms
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
Responder1
sudo apt-get update
sudo apt-get install ssh
sudo ufw allow 22
Esse é o mínimo. Ele permite tentativas ilimitadas de senha com falha em uma porta conhecida. O login root direto está desabilitado (você ainda pode su e sudo uma vez logado). Se o seu nome de usuário e senha puderem ser adivinhados e a Internet puder ver o servidor, alguém acabará invadindo.
Por padrão, o usuário root não tem permissão para fazer ssh de fora no Ubuntu. você pode mudar para
sudo sed -ir 's/^(PermitRootLogin) .+/\1 yes/' /etc/ssh/sshd_config
sudo /etc/init.d/ssh restart
Se ainda assim você estiver enfrentando problemas, por favor, tente, telnet machineip 22
ele mostrará que você tem 22 portas acessíveis de outra máquina. Tente tornar o ssh seguro, siga istolink