我有我的bashrc文件设置为我喜欢。我通常工作在一个硬件插入远程服务器。我ssh进入该远程服务器。我希望我的.bashrc运行时,我ssh进入远程服务器,而是在服务器上的bashrc。无论如何,我可以做到这一点。
AFAIK,没有办法做到这一点。
也许你应该把你的~/.bashrc
复制到一个服务器上,然后在所有其他服务器上安装一个configurationpipe理工具(Puppet,Chef,…)。
我认为sshrc是你要找的: https : //github.com/Russell91/sshrc
sshrc和ssh一样工作,但是在远程login后也会发送〜/ .sshrc。
$ echo "echo welcome" > ~/.sshrc $ sshrc me@myserver welcome $ echo "alias ..='cd ..'" > ~/.sshrc $ sshrc me@myserver $ type .. .. is aliased to `cd ..'
您可以使用它来设置环境variables,定义函数,并运行login后命令。 这很简单,而且不会影响服务器上的其他用户 – 即使他们也使用sshrc。 要获得更高级的configuration,请继续阅读。
我认为, https://github.com/fsquillace/pearl-ssh做你所需要的。
在sshrc诞生之前我就写了很久,和sshrc相比,它有更多的好处:
例如:
$> echo "alias q=exit" > ~/.config/pearl/sshrc $> ssh_pearl [email protected] myserver.com $> q exit