SSH를 통해 EC2 서버에 접속하면 오류가 발생합니다. 루트 사용자가 아닌 ec2-user 사용자로 로그인하십시오.
제목으로 질문. 그 이유는 다음과 같습니다. ssh 명령을 사용했습니다. ssh -i mykey.pem root@xxx-xxx-xx-xx-xxx.compute-1.amazonaws.com하지만 그 오류가 발생하면 Google에서 아무것도 찾지 못합니다. 내가 도대체 뭘 잘못하고있는 겁니까?
ec2-user
Klaus가 제안한 대로 로그인합니다 .
ssh -i key.pem ec2-user@host
... sudo
명령을 실행 하는 데 사용 합니다. 예를 들어, /etc/hosts
루트가 소유하고 루트 권한이 필요한 파일 을 편집 하려면 : sudo nano /etc/hosts
.
또는 사용자 sudo su
가되기 위해 실행 합니다 root
.
기본적으로 root
사용자는 로그인이 허용되지 않지만 ec2-user
다른 사람이 지정한대로 사용할 수 있습니다 .
로그인 하면 SSH 구성으로 ec2-user
전환 root
하고 변경하십시오.
루트 사용자가 되려면 다음을 실행하십시오.
sudo su -
/etc/ssh/sshd_config
예를 들어 vi를 사용하여 SSH 데몬 구성 파일을 편집하고 PermitRootLogin
항목을 다음으로 바꿉니다.
PermitRootLogin without-password
다음을 실행하여 SSH 데몬 구성을 다시로드합니다.
/etc/init.d/sshd reload
Please login as the ec2-user user rather than root user.
개인 키로 로그인하면 명령이 실행되기 때문에 메시지 가 표시됩니다. 해당 명령을 제거하려면 ~/.ssh/authorized_keys
파일을 편집 하고 command
옵션을 제거하십시오 . 행은 키 유형 (예 : ssh-rsa)으로 시작해야합니다.
(*) 자신의 책임하에 수행하십시오. 구성을 변경 한 후 로그인 할 수없는 경우를 대비하여 항상 콘솔을 열어 두는 것이 좋습니다.
참조를 위해 man 페이지를 읽을 수 있습니다.
man sshd_config
man sshd
Amazon ec2에서 hadoop 클러스터를 설정할 때 비슷한 문제가 발생했습니다.
내 헤드 노드에는 각 작업자 / 슬레이브 노드에 대한 루트 ssh 액세스 권한이 있어야합니다. 각 슬레이브 노드의 IP 주소, 개인 주소 및 별칭 이름을 /etc/hosts/
파일 에 추가하여 연결에 별칭을 지정했습니다 . (필자는 명령을 실행하여 데이터를 얻을 수 echo -e "`hostname -i`\t`hostname -f`\talias-name"
어디서 alias-name
나는 각 노드 (부릅니다 head
또는 n1
다음. 예를 들어) 나는 모든 노드의 각 노드에 대해 그 출력을 넣어 /etc/hosts
파일.
내가 직면 한 문제는 첫 번째 슬레이브 노드에 ssh하기 위해 헤드 노드에있는 동안 ssh n1을 입력 할 때 동일한 오류 메시지가 표시된다는 것입니다. Please login as the use "ec2-user" rather than the user "root".
따라서 몇 가지 조사를 수행 한 후 문제를 해결하는 방법을 알아 냈습니다.
먼저:
- 서버에 ssh. 비 루트 (ec2-user) 액세스는 여기서 괜찮습니다.
- 그런 다음
su -
루트로 이동하십시오. 이제vi /etc/ssh/sshd_config
줄의 주석 처리를 제거하십시오PermitRootLogin yes
. - vi 편집기를 종료하십시오.
- 이제
service sshd stop
다음 을 입력하여 ssh 데몬을 다시 시작service sshd start
합니다.
둘째:
- 자, 여기 제가 발굴해야 할 부분이 있습니다.
- 운영
vi /root/.ssh/authorized_keys
- 에 이르기까지 주석
ssh-rsa.
단은 넣어#
전에 파일의 내용의 시작 부분에no-port-forwarding
... 그리고에 Enter 키를 누르십시오ssh-rsa
다음 줄 (이 경우 삭제 아무것도 필요 없다 이런 식으로 당신이 철수하려는)로 이동합니다. - vi 편집기 종료
이제 오류 메시지가 나타나지 않고 루트에 로그인 할 수 있습니다.
또한 클러스터 설정에 별명을 사용하는 경우; 각 노드에서 동일한 단계를 반복하십시오. 먼저 ec2-user를 사용하여 ssh 한 다음 단계를 따릅니다. IP 주소, 개인 주소 및 별칭 이름 정보를 /etc/hosts
파일에 추가 한 후 예를 들어 별칭 이름을 사용하여 각 노드의 루트로 ssh 할 수 있어야합니다 ssh n1
.
The tutorial I followed is here: https://www.youtube.com/watch?v=xrxQXfE7t9A
But it didnt discuss the problem with root login.
Hope that helps! It worked for me.
*Keep in mind that I havnt taken any security into concern. This is simply a practice/dev setup.
I think it's just asking you to login with another username. Do you happen to have a user called ec2-user
? If so, try this instead:
ssh -i mykey.pem ec2-user@xxx-xxx-xx-xx-xxx.compute-1.amazonaws.com
I have faced the same problem when I tried to access my EC2 instance as 'root' through Windows PuTTY client, this is how I solved problem.
Access and edit SSH configuration file, to allow root login and password authentication.
- Login as ec2-user (by default it is allowed)
Enter below command to open ssh config
sudo vi /etc/ssh/sshd_config
Edit SSH configuration file as below using vi, how to use vi editor
PermitRootLogin yes (remove # at begging if it present)
PasswordAuthentication yes
Restart SSH
sudo /etc/init.d/sshd restart
Change/set root password
sudo passwd root
type new password and re-enter it (at least 8 characters)
Exit current session and close PuTTY
exit
- Try again login as root and type previously set password.
Solved! Try compare root key file and user key file)
diff /root/.ssh/authorized_keys /home/user/.ssh/authorized_keys
...and see
Edit /etc/ssh/sshd_config, and make sure this is set:
PasswordAuthentication yes
Then reload SSH:
systemctl reload sshd.service
You can now log in as users other than ec2-user.
ReferenceURL : https://stackoverflow.com/questions/4230516/sshing-into-ec2-server-via-gives-error-please-login-as-the-ec2-user-user-rather
'Development Tip' 카테고리의 다른 글
자바 스크립트 DOM 텍스트 노드에서 교체 (0) | 2021.01.09 |
---|---|
IE에서 필터를 제거하려면 어떻게합니까? (0) | 2021.01.09 |
리퍼러를 목적지로 보내는 링크 중지 (0) | 2021.01.09 |
bash for 루프에서 명령 줄 인수 범위를 사용하면 인수가 포함 된 대괄호가 인쇄됩니다. (0) | 2021.01.09 |
currentTimeMillis를 읽을 수있는 날짜 형식으로 변환하는 방법은 무엇입니까? (0) | 2021.01.09 |