我有一个在调用时调用的脚本ssh
(在 Linux 上)来运行一些命令,然后以其他用户身份登录- 当我使用任何基于 Linux的客户端su -l <anotheruser>
时,这一切都运行正常。但是当我尝试使用 WinScp(选项中有文件协议)时,它不起作用!在进一步故障排除时,似乎通过调用的 shell不知何故被杀死了!因此,我在 WinScp 日志中看到以下内容:scp
ssh
SCP
su -l <anotheruser>
(EFatal) **Connection has been unexpectedly closed.** Server sent command exit status 1
但我无法弄清楚为什么仅su
在使用 WinScp 时登录 shell 才会被终止!有任何指示可以进一步调试吗?
- 编辑 -
WinSCP 日志的最后几行:
! 2024-07-27 00.23.13.824 su: must be run from a terminal
. 2024-07-27 00.23.13.824 Session sent command exit status 1
. 2024-07-27 00.23.13.824 Main session channel closed
. 2024-07-27 00.23.13.824 All channels closed
. 2024-07-27 00.23.13.824 Timeout waiting for network events
. 2024-07-27 00.23.13.824 Waiting for another 1 bytes
. 2024-07-27 00.23.13.824 Looking for incoming data
. 2024-07-27 00.23.13.824 Looking for network events
. 2024-07-27 00.23.13.824 Attempt to close connection due to fatal exception:
* 2024-07-27 00.23.13.824 **Connection has been unexpectedly closed.** Server sent command exit status 1.
. 2024-07-27 00.23.13.824 Closing connection.
. 2024-07-27 00.23.13.824 Selecting events 0 for socket 1932
* 2024-07-27 00.23.13.856 (EFatal) **Connection has been unexpectedly closed.** Server sent command exit status 1.
* 2024-07-27 00.23.13.856 Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended).
是否
! 2024-07-27 00.23.13.824 su: must be run from a terminal
指出问题!?
我的脚本通过 NSS 插件调用(libnss-ato
)
--编辑2--
在使用su
具有--pty
选项的 util-linux 版本后,winscp 似乎卡住了!日志:
< 2024-08-02 15.00.55.772 tani1@sys7-vm81B$ echo "WinSCP: this is end-of-file:0"
. 2024-08-02 15.00.55.772 Read 31 bytes (18 pending)
< 2024-08-02 15.00.55.772 WinSCP: this is end-of-file:0
. 2024-08-02 15.00.55.772 Read 18 bytes (0 pending)
. 2024-08-02 15.00.55.772 Waiting for another 1 bytes
. 2024-08-02 15.00.55.772 Looking for incoming data
. 2024-08-02 15.00.55.772 Looking for network events
. 2024-08-02 15.01.12.135 Timeout waiting for network events
. 2024-08-02 15.01.12.135 Waiting for data timed out, asking user what to do.
. 2024-08-02 15.01.12.135 Asking user:
. 2024-08-02 15.01.12.135 **Host is not communicating for 15 seconds.
. 2024-08-02 15.01.12.135
. 2024-08-02 15.01.12.135 Wait for another 15 seconds?** ()