보시다시피 이미 사용되고 있지만 터널이 생성된 로컬 포트를 수신 대기하는 다른 터널을 생성하려고 하면 오류 메시지가 나타납니다. 특정 포트를 사용하는 다른 프로세스가 있는 경우 SSH가 특정 포트에 터널을 생성하지 않도록 강제할 수 있나요?
┌─[wakatana@~] [79 files, 89Mb]
└──> ps -elf | grep 'ssh -fN'
1 S wakatana 4263 1 0 80 0 - 10660 - May02 ? 00:00:00 ssh -fN -L 5901:localhost:5901 [email protected]
0 S wakatana 6340 4754 0 80 0 - 1959 - 00:22 pts/7 00:00:00 grep --color=auto ssh -fN
┌─[wakatana@~] [79 files, 89Mb]
└──> ssh -fN -L 5900:192.168.1.1:3389 [email protected]
┌─[wakatana@~] [79 files, 89Mb]
└──> ps -elf | grep 'ssh -fN'
1 S wakatana 4263 1 0 80 0 - 10660 - May02 ? 00:00:00 ssh -fN -L 5901:localhost:5901 [email protected]
1 S wakatana 6371 1 0 80 0 - 10355 - 00:22 ? 00:00:00 ssh -fN -L 5900:192.168.1.1:3389 [email protected]
0 S wakatana 6381 4754 0 80 0 - 1959 - 00:22 pts/7 00:00:00 grep --color=auto ssh -fN
┌─[wakatana@~] [79 files, 89Mb]
└──> ssh -fN -L 5900:192.168.1.3:3389 [email protected]
bind: Address already in use
channel_setup_fwd_listener: cannot listen to port: 5900
Could not request local forwarding.
┌─[wakatana@~] [79 files, 89Mb]
└──> ps -elf | grep 'ssh -fN'
1 S wakatana 4263 1 0 80 0 - 10660 - May02 ? 00:00:00 ssh -fN -L 5901:localhost:5901 [email protected]
1 S wakatana 6371 1 0 80 0 - 10355 - 00:22 ? 00:00:00 ssh -fN -L 5900:192.168.1.1:3389 [email protected]
1 S wakatana 6391 1 0 80 0 - 10355 - 00:23 ? 00:00:00 ssh -fN -L 5900:192.168.1.3:3389 [email protected]
0 R wakatana 6401 4754 0 80 0 - 1958 - 00:23 pts/7 00:00:00 grep --color=auto ssh -fN
답변1
질문을 어떻게 정리해야 할지 고민해봤는데 시간이 없네요. 제가 대신 답변해 드리겠습니다. 'ExitOnForwardFailure' 옵션을 yes로 설정해야 합니다.
$ ssh -fN -o ExitOnForwardFailure=yes -L 5900:192.168.1.1:3389 [email protected]
$ ssh -fN -o ExitOnForwardFailure=yes -L 5900:192.168.1.3:3389 [email protected]
bind: Address already in use
channel_setup_fwd_listener: cannot listen to port: 5900
Could not request local forwarding.
$ ps auwwx | grep ssh | grep 1111
daniel 94948 0.0 0.0 2461204 520 ?? Ss 2:56pm 0:00.00 ssh -Nf -o ExitOnForwardFailure=yes -L 5900:192.168.1.1:3389 MY.PUB.IP.ADDR