EC2密钥对信息在一台服务器上运行,但不在另一台服

时间:2017-10-09 18:15:18

标签: amazon-ec2 pem

我有一个服务器密钥对已经工作了几年。我今天创建了一个新服务器并要求它使用相同的密钥对信息。我在控制台中验证了两者都使用相同的密钥对信息。

我可以使用pem文件import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { MainComponent } from './main.component'; import { ModalComponent } from './../modal/modal.component'; import { SecondComponent } from './../second/second.component'; describe('MainComponent', () => { let component: MainComponent; let fixture: ComponentFixture<MainComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ MainComponent, ModalComponent, SecondComponent ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(MainComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should be created', () => { expect(component).toBeTruthy(); }); describe('openModal', () => { it('should call the `showModal` method on the `secondComponent` property we have on our component', () => { // Arrange let secondComponent = component.secondComponent; let spy = spyOn(secondComponent, 'showModal'); // Act component.openModal(); // Assert expect(spy).toHaveBeenCalled(); }); }); });进入我的新服务器。所以我知道pem文件没有损坏。但是,我不能ssh进入我的旧服务器了。

错误是:ssh

我仍然对我的旧服务器具有读取权限(我打开了一个标签,这是ssh&#39;)但似乎没有写入权限。

什么可能导致此问题,我该如何解决?

仅供参考,Permission denied (publickey).似乎仍包含与此pem文件关联的公钥。这两个服务器上的公钥是相同的。

更新: 我99%确定用户是正确的。我正在使用.ssh/authorized_keys。这是我在之前打开的ssh窗口中看到的用户。此外,当我尝试以root身份登录时,我收到错误:ubuntu

更新#2:

这里是带有-vvv

的ssh的输出
Please login as the user "ubuntu" rather than the user "root".

1 个答案:

答案 0 :(得分:1)

我猜你不小心改变了文件library(R2jags) library(mcmc) setwd("PATH-NAME") # ******************************************************* # Data are coded below: # BA -1 # BMS -2 *** REFERENCE # DCB -3 # EES -4 # PES -5 # ROTA -6 # SES -7 # VBT -8 # ******************************************************* t_RCT = structure(.Data=c(1,6,NA, 1,6,NA, 1,2,NA, 1,2,NA, 2,6,NA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,1,1,1,1, 121,1,1,1,1,1,1,131, 232,1,1,1,1,1,1,244, 78,1,1,1,1,1,1,78, 1,1,1,1,195,1,1,201, 1,1,1,1,20,1,1,17, 100,1,1,1,100,1,100,1, 74,1,1,1,1,1,76,1, 1,1,1,1,1,1,259,125, 1,1,1,1,1,1,65,64, 1,1,1,1,225,1,225,1, 61,1,1,1,1,1,136,1, 48,1,1,1,1,1,48,1, 1,1,1,34,1,1,32,1, 1,1,95,94,1,1,1,1, 1,1,154,155,1,1,1,1, 54,1,54,1,1,1,1,1, 1,1,66,1,65,1,1,1, 25,1,25,1,1,1,1,1, 38,1,72,1,1,1,1,1, 72,1,138,1,1,1,1,1, 134,1,137,1,131,1,1,1, 1,1,109,1,106,1,1,1), .Dim=c(28,8)) dataR <- list(nS=28, nT=8, ref=2, t=t_RCT, na=na_RCT, r=r_RCT, n=n_RCT) initR<-list(list(u=rep(0,28), tau=0.5),list(u=rep(0.2,28), tau=0.7)) Params<-c("u","OR") ModelFit<-jags(data=dataR, inits=initR, Params, n.chains=2, n.iter=5000, n.burnin=2500, model.file=Model, n.thin=5) Result<-ModelFit$BUGSoutput$summary write.table(round(Result,digits=3), "Results.txt",row.names=T,col.names=T) DIC<- ModelFit$BUGSoutput$DIC write.table(round(DIC,digits=3), "Dic.txt",row.names=T,col.names=T) postscript("PostDen.ps") ModelFit.mcmc <- as.mcmc(ModelFit) densplot(ModelFit.mcmc) dev.off() 的权限。我已经复制了这个错误。根据AWS,/home/ubuntu/.ssh/authorized_keys必须仅限于所有者。

如果您已退出,那么您有两种方法可以解决此问题。

方法1:停止您的实例,点击/home/ubuntu/.ssh/authorized_keys添加以下用户数据,然后启动实例

Actions->Instance Settings->View/Change User Data

方法2:您可以启动调试实例。然后停止旧服务器并将旧服务器的根卷安装到调试实例,并运行以下命令以设置正确的权限:

Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0

--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"

#cloud-config
cloud_final_modules:
- [scripts-user, always]

--//
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"

#!/bin/bash
chmod 600 /home/ubuntu/.ssh/authorized_keys
chmod 700 /home/ubuntu/.ssh
chmod 700 /home/ubuntu
--//

它不起作用,您可以按照步骤对您的实例进行问题排查:Error: Host key not found, Permission denied (publickey), or Authentication failed, permission denied