$ cat ~/.ssh/config ServerAliveInterval 60 SendEnv NO TCPKeepAlive yes ServerAliveInterval=15 ServerAliveCountMax=6 Compression=yes ForwardAgent=yes #GSSAPIAuthentication no ControlMaster auto ControlPath /tmp/ssh_mux_%h_%p_%r Host * StrictHostKeyChecking no |
echo $SHELL
http://segmentfault.com/a/1190000000606752#articleHeader2
搜索:设置默认shell
对bash, 修改~/.bashrc, 添加
#如果是mac系统,修改添加~/.bash_profile
SSH_ENV="$HOME/.ssh/environment" function start_agent { #echo "Initialising new SSH agent..." /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" #echo succeeded chmod 600 "${SSH_ENV}" . "${SSH_ENV}" > /dev/null /usr/bin/ssh-add; } if [ -f "${SSH_ENV}" ]; then . "${SSH_ENV}" > /dev/null ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { start_agent; } else start_agent; fi |
对zsh, 修改~/.zshrc, 添加
SSH_ENV="$HOME/.ssh/environment" function start_agent { #echo "Initialising new SSH agent..." /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" #echo succeeded chmod 600 "${SSH_ENV}" . "${SSH_ENV}" > /dev/null /usr/bin/ssh-add; } if [ -f "${SSH_ENV}" ] then . "${SSH_ENV}" > /dev/null ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null if [ ! "$?" = "0" ]; then start_agent; fi else start_agent; fi |
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。