~/.ssh/rc 自动登录分开 shell

~/.ssh/rc Auto Login to seperate shell

下面是我在 RC 文件中使用的代码块。这个想法是直接进入另一个服务器 ssh 会话(没有端口转发)。执行时,我会看到会话。这就是说,它快速闪烁并且不是交互式的。我相信这是设计使然,但是,在特定用户登录后,还有另一种调用 ssh 命令的方法吗?如果没有,您是否知道使屏幕具有交互性的解决方法?谢谢。

if [ ! -z "$SSH_CONNECTION" ]
then
ssh -i ~/.ssh/id_rsa user@xxx.xxx.xxx.xxx
fi

问题是在 ~/.profile 中调用 bashrc,将 ssh 连接附加到 ~/.profile 的末尾已解决问题。