Google Computer Engine中的FreeBSD权限被拒绝(公钥) [英] Permission denied (publickey) FreeBSD in Google Computer Engine

查看:104
本文介绍了Google Computer Engine中的FreeBSD权限被拒绝(公钥)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在通过google云通过SSH访问实例时遇到问题,并且在尝试远程连接时遇到问题,当尝试在Mac上使用gcloud命令进行连接时,它告诉我:

I have problems accessing my instance via SSH through the google cloud and also when trying to connect remotely, when trying to connect using the gcloud command on my mac it tells me:

Permission denied (publickey).
ERROR: (gcloud.beta.compute.ssh) [/usr/bin/ssh] exited with return code [255].

我正在使用的命令如下:

The command I am using is the following:

gcloud beta compute --project "my-instance" ssh --zone "server" "freebsd-11-1"

这是什么?,我将SSH密钥导入到实例的元数据中.

What can it be ?, I import the SSH keys into the metadata of my instance.

我不知道它们是否影响.ssh文件夹的权限,我也不知道它们是什么

I don't know if they affect the permissions of the .ssh folder, I don't know what they are

推荐答案

由于以下原因,权限被拒绝,错误代码为255:

Permission denied with error code 255 can be due to the following reasons:

1.错误的用户.使用以下命令,确保在IAM中具有适当角色的适当用户进行身份验证

1.Incorrect user. Make sure to authenticate with appropriate user having the appropriate role in IAM by using the following commands

gcloud auth list

检查活动用户

gcloud auth login

使用适当的用户登录

2.按键问题.强制gcloud重新创建用户的SSH密钥对,然后再次尝试SSH.使用以下命令将现有的密钥对移到一边:

2.Issue with keys. Force gcloud to recreate the user’s SSH key pair and try to SSH again. Move the existing key pair aside using these commands:

   mv ~/.ssh/google_compute_engine ~/.ssh/old-google_compute_engine
   mv ~/.ssh/google_compute_engine.pub ~/.ssh/old-google_compute_engine.pub

3.防火墙问题.检查您的防火墙,以查看是否为该实例打开了端口22.

3.Firewall issue. Check your firewall to see if port 22 is opened for the instance in question.

4.卷或内存有问题.通过转到串行控制台日志[菜单> Compute Engine> Vm_name> Logs(串行端口控制台)],确保根卷没有磁盘空间不足或没有内存不足的问题.您正在寻找以下线索

4.Volume or memory issue. Make sure root volume is not out of disk space or that there are no out of memory issues by going to serial console logs [Menu>Compute Engine>Vm_name>Logs (serial port console)]. You are looking for the following clues

  • 设备上没有剩余空间
  • 找不到可用的临时目录
  • 内存不足

增大启动磁盘大小或增大计算机类型可能会有所帮助.

Increasing the boot disk size or increasing the machine type might help.

5.Linux Guest Environment脚本问题.为了解决来宾环境问题,您可以查看以下文档,以验证预期输出,以及如何安装

5.Linux Guest Environment scripts issue. In order to fix a guest environment issue you may check the following documentation in order to verify the expected output and how to install the required packages.

6.权限问题.检查文件夹和Authorized_keys文件权限.

6.Permission issue. Check folder and Authorized_keys file permissions.

5和6可能很难执行,但是您可以通过串行控制台以这种方式登录:

5 and 6 might be difficult to perform if you cannot SSH, however you can log in via serial console this way:

a).激活连接到串行控制台"按钮.

a). Activate the "Connect to serial console" button.

转到虚拟机实例,单击您的虚拟机,然后在远程访问"区域中单击编辑",然后激活启用连接到串行端口",然后单击保存".

Go to VM instances, click on your VM, Edit, and active "enable connecting to serial ports" in the Remote access area and click on save.

b).创建用户名和密码.

b). Create a username and password.

转到Vm实例,再次单击您的Vm,进行编辑,并使用以下命令填充自定义元数据部分:

Go to Vm instance, click on your Vm again, Edit, and fill up the custom metadata section with:

输入键:启动脚本

值:

#!/bin/bash  sudo useradd -G sudo pamela sudo echo 'pamela:pamela5' | chpasswd

(这是一个脚本,它将创建用户名:pamela和密码:pamela5,稍后将使用.出于安全目的,请使用其他方式.这只是一个示例.请注意,实例可能需要重新引导才能进行更改生效.)

(This is a script that creates a username : pamela and password: pamela5, which you are going to use later. Please use something else for security purposes. This is only an example. Note that instance might require a reboot for changes to take effect.)

这篇关于Google Computer Engine中的FreeBSD权限被拒绝(公钥)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆