本文介绍了Google Cloud Engine.权限被拒绝(公钥,gssapi-keyex,gssapi-with-mic)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法再通过ssh进行连接,我能够连接将近24小时.ssh突然停止工作.我有很多用户,并且还在该VM中添加了一个新的(tomcat)用户.

I can not connect via ssh any more,I was be able to connect for almost 24 hours.All of a sudden, ssh stops working.I had many users and I also added a new (tomcat) user in that VM.

当我尝试SSH到我的实例时,我得到以下消息:

I am get the below message when I try to ssh to my instance:

"Permission denied (publickey,gssapi-keyex,gssapi-with-mic)."

我最终删除了〜/.ssh/google_compute_engine *

I ended up removing ~/.ssh/google_compute_engine*

从Cloud Engine控制台中删除了"sshKeys"元数据

Removed the 'sshKeys' metadata from Cloud Engine Console

再次尝试,这会创建一个新的~/.ssh/google_compute_engine文件以及sshKeys metadata.

但我仍然遇到该错误.

推荐答案

这确实是对 @sxleixer 的正确解决方案的评论,但我想进行格式化.

This is really a comment on the correct solution by @sxleixer, but I wanted formatting.

  1. 默认情况下未安装semanage工具.用

sudo yum -y install policycoreutils-python

  • 允许非标准的ssh_home_t

  • Allow the nonstandard ssh_home_t

    sudo semanage fcontext -a -t ssh_home_t "/var/opt/gitlab/.ssh/authorized_keys"
    

  • 要么重新启动sshd,要么使用

  • Either restart sshd or do a full restart with

    sudo shutdown -r now
    

  • 测试一切都在本地工作

  • Test everything is working locally

    ssh-keygen -t rsa -C "[email protected]"
    cat ~/.ssh/id_rsa.pub # Copy-paste the key to the 'My SSH Keys' section under the 'SSH' tab in your user profile
    ssh -T git@localhost  # Should now output "Welcome to GitLab"
    

  • 这修复了在Google Compute Engine上一键安装GitLab的问题.

    This fixes the one click installation of GitLab on Google Compute Engine.

    确实没有充分的理由关闭SELinux.

    There is indeed no good reason to turn off SELinux.

    这篇关于Google Cloud Engine.权限被拒绝(公钥,gssapi-keyex,gssapi-with-mic)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    08-05 03:30