내 노트북(10.197.1.xx)과 데스크탑(10.141.200.xxx)에서 우분투 16.04(메이트)가 실행되고 있습니다. 둘 중 하나에서 다른 하나에 핑을 보낼 수 있습니다. 하지만 ssh는 간다시간 초과(연결을 거부하거나 경고 또는 오류 메시지를 표시하지 않습니다).
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
문제의 PC와 노트북 모두openssh-서버설치되었습니다.
$ 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.
방화벽 상태는비활성
sudo ufw status
Status: inactive
무엇이 잘못되었을 수 있나요? SSH를 작동시키려면 어떻게 해야 합니까?
업데이트
프로그램 traceroute
은 다음과 같은 출력을 생성했습니다.
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 * * *
답변1
sudo apt-get update
sudo apt-get install ssh
sudo ufw allow 22
그것은 최소한입니다. 알려진 포트에서 무제한의 비밀번호 실패 시도를 허용합니다. 직접 루트 로그인이 비활성화되었습니다(로그인한 후에도 여전히 su 및 sudo를 사용할 수 있습니다). 사용자 이름과 비밀번호를 추측할 수 있고 인터넷에서 서버를 볼 수 있다면 결국 누군가가 침입하게 될 것입니다.
기본적으로 루트 사용자는 우분투 외부에서 SSH를 사용할 수 없습니다. 당신은로 변경할 수 있습니다
sudo sed -ir 's/^(PermitRootLogin) .+/\1 yes/' /etc/ssh/sshd_config
sudo /etc/init.d/ssh restart
그래도 문제가 발생하면 telnet machineip 22
다른 컴퓨터에서 액세스할 수 있는 22 포트가 있는지 확인해 보세요. SSH를 안전하게 만드십시오.링크