我想通过ssh登录我的账户,但是我不想执行当前版本的.profile登录脚本。有没有办法在登录时不运行.profile呢?
(免责声明:我找到了一个解决方法,已在下面发布,但我想知道是否有更好的答案)
(免责声明:我找到了一个解决方法,已在下面发布,但我想知道是否有更好的答案)
ssh -t user@host bash --noprofile
-t
选项来强制分配tty的位置。scp me@machine:.profile .
# Fix .profile
scp .profile me@machine:.
ssh me@machine
.bashrc
文件中,我已经添加了以下内容:if [ -z "$SSH_CLIENT" ] ; then
...
fi
周围的不兼容SSH的东西。 SSH_CLIENT
仅适用于通过ssh调用的shell,而不适用于其他shell。
ssh user@somewhere "env >env.ssh"
env >env.local
diff env.local env.ssh