ssh: connect to host **.***.*.** port 22: Connection timed out lost connection
이렇게 에러메시지가 발생하면서 자료 이동이 불가능했다.
이거 해결하려고 주말 밤에 시간 좀 썼는데 결국 해결을 못했다.
메일 보내서 답장 받고 알고보니 회사 정책상 ssh 22 포트는 차단되어있단다.
ㅠ-ㅠ...
특정 포트를 추가해줘야 하는데 예를 들어 1234라고 하겠다.
포트를 추가해주기 위해서
#vi /etc/ssh/sshd_config
열어서
새로운 포트번호를 추가해주자.
Port 1234
저장한 뒤 나와서
# service sshd restart
그러면 에러 메시지가 발생한다.
Redirecting to /bin/systemctl restart sshd.service Job for sshd.service failed because the control process exited with error code. See "systemctl shd.service" and "journalctl -xe" for details.
# journalctl -xe
에러 메시지를 자세히 출력해본다.
-- Unit sshd.service has finished shutting down. Aug 02 20:29:03 localhost.localdomain systemd[1]: Starting OpenSSH server daemon... -- Subject: Unit sshd.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit sshd.service has begun starting up. Aug 02 20:29:03 localhost.localdomain sshd[65236]: error: Bind to port 1234 on 0.0.0.0 failed: Aug 02 20:29:03 localhost.localdomain sshd[65236]: fatal: Cannot bind any address. Aug 02 20:29:03 localhost.localdomain systemd[1]: sshd.service: main process exited, code=exite Aug 02 20:29:03 localhost.localdomain systemd[1]: Failed to start OpenSSH server daemon. -- Subject: Unit sshd.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit sshd.service has failed. -- -- The result is failed.
<?xml version="1.0" encoding="utf-8"?> <zone> <short>Public</short> <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> <source address="12.34.5.678"/> <source address="12.34.5.67"/> <service name="ssh"/> <service name="dhcpv6-client"/> <port protocol="tcp" port="1234"/> </zone>
port 1234가 추가되어있는 것을 확인할 수 있다.
source address는 내가 이것저것 만지다가 저장된 것이다.
회사 내부 아이피니까 그냥 두어도 크게 상관 없을거라 생각되어서 그냥 두었다.
파일 이동해줄때 추가해준 포트로 이동시켜주자.
$ scp -P 1234 test.py 12.345.6.78:/home
GPU 머신 하나 쓰기가 이렇게 힘들다 ㅠ
참고로 이렇게 포트 변경하고 나면 원격 접속 프로그램으로 다시 접속 할 때 포트 번호 바꾸어서 접속 해야한다.