![SSH 在一条命令结束时挂起](https://linux22.com/image/1406959/SSH%20%E5%9C%A8%E4%B8%80%E6%9D%A1%E5%91%BD%E4%BB%A4%E7%BB%93%E6%9D%9F%E6%97%B6%E6%8C%82%E8%B5%B7.png)
以下命令没有出现:
ssh -x -l root asr-bng-ubuntu "/usr/local/sbin/radiusd"
但是当我检查控制台时,进程已经开始了。能够在控制台中毫无问题地执行相同的命令(/usr/local/sbin/radiusd),其他命令也通过 ssh 执行(例如 ssh -x -l root asr-bng-ubuntu“ls”)
-vvv 的调试输出如下:
root@asr-bng-ubuntu's password:
debug3: packet_send2: adding 64 (len 55 padlen 9 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug1: Sending command: /usr/local/sbin/radiusd
debug2: channel 0: request exec confirm 0
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 ------>Hangs here
答案1
您的命令工作正常,ssh 正在等待命令终止以关闭连接。
看着serverfault 上的这个问题。并尝试以下操作:
ssh -x -l root server "/usr/local/sbin/radiusd &"