当我使用xubuntu 19.10时,SSH代理转发功能非常好,在我将我的系统升级到xubuntu 20.04之后,它就不再工作了。我从不更改/etc/ssh/config或/home/.ssh/config。下面是我当前的~/..ssh/config,如下所示:
Host my_remote_server_ip
ForwardAgent yes在系统升级之后,当我尝试运行git时,在远程服务器上拉出以下错误:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.发布于 2020-06-28 11:33:12
似乎ssh代理没有自动启动。我将以下内容添加到我的.bashrc中(参见这里):
vi ~/.bashrc
# Start SSH Agent
#----------------------------
SSH_ENV="$HOME/.ssh/environment"
function run_ssh_env {
. "${SSH_ENV}" > /dev/null
}
function start_ssh_agent {
echo "Initializing new SSH agent..."
ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo "succeeded"
chmod 600 "${SSH_ENV}"
run_ssh_env;
ssh-add ~/.ssh/id_rsa;
}
if [ -f "${SSH_ENV}" ]; then
run_ssh_env;
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_ssh_agent;
}
else
start_ssh_agent;
fi在注销并与用户登录之后,它就像以前在ubuntu中一样工作。
https://askubuntu.com/questions/1238955
复制相似问题