Unable to establish SSH connection between two AMI ec2 instances

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Trying to establish ssh connection between two ec2 instances. Copied Host A id_rsa.pub key to Host B's authorized_keys file
[root@ip-172-31-9-173 .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTTRSTwBClsq7/punxLQvq00Ba7iMZRbQKAQhC+GVuQFB2LfWk9Hsetu4CqHoGo4R4BJ/SW/4v+AfKlmQ/kA8WrQ12R0dR9cuhEbbnltMXSauwrsndIf4egJVzJs3BM12jXEx+E6wSlK8nUu3xpmY12WUkJOAWfWJ6rnE4XArIcmtNzfpJyZgFhNv2fKYRBTCgU0l4HLo2uIiQj8/aLT2gQeRUdARNn3QLBrITMN6rojo1vmWYnXhjWxeUoYVDj5+bsrqfbAtyzPm43WS+2RZ0T1Rr50+REl+jin0y108v04me7BluidN013oj+gLI73A86/qBgo08l5RwG2p+oOzf root@ip-172-31-9-173
[root@ip-172-31-11-205 .ssh]# cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTTRSTwBClsq7/punxLQvq00Ba7iMZRbQKAQhC+GVuQFB2LfWk9Hsetu4CqHoGo4R4BJ/SW/4v+AfKlmQ/kA8WrQ12R0dR9cuhEbbnltMXSauwrsndIf4egJVzJs3BM12jXEx+E6wSlK8nUu3xpmY12WUkJOAWfWJ6rnE4XArIcmtNzfpJyZgFhNv2fKYRBTCgU0l4HLo2uIiQj8/aLT2gQeRUdARNn3QLBrITMN6rojo1vmWYnXhjWxeUoYVDj5+bsrqfbAtyzPm43WS+2RZ0T1Rr50+REl+jin0y108v04me7BluidN013oj+gLI73A86/qBgo08l5RwG2p+oOzf root@ip-172-31-9-173
Error:
[root@ip-172-31-9-173 ~]# ssh root@172.31.11.205
Permission denied (publickey).
Not sure what is missing here.
ssh amazon-ec2 aws
add a comment |Â
up vote
0
down vote
favorite
Trying to establish ssh connection between two ec2 instances. Copied Host A id_rsa.pub key to Host B's authorized_keys file
[root@ip-172-31-9-173 .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTTRSTwBClsq7/punxLQvq00Ba7iMZRbQKAQhC+GVuQFB2LfWk9Hsetu4CqHoGo4R4BJ/SW/4v+AfKlmQ/kA8WrQ12R0dR9cuhEbbnltMXSauwrsndIf4egJVzJs3BM12jXEx+E6wSlK8nUu3xpmY12WUkJOAWfWJ6rnE4XArIcmtNzfpJyZgFhNv2fKYRBTCgU0l4HLo2uIiQj8/aLT2gQeRUdARNn3QLBrITMN6rojo1vmWYnXhjWxeUoYVDj5+bsrqfbAtyzPm43WS+2RZ0T1Rr50+REl+jin0y108v04me7BluidN013oj+gLI73A86/qBgo08l5RwG2p+oOzf root@ip-172-31-9-173
[root@ip-172-31-11-205 .ssh]# cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTTRSTwBClsq7/punxLQvq00Ba7iMZRbQKAQhC+GVuQFB2LfWk9Hsetu4CqHoGo4R4BJ/SW/4v+AfKlmQ/kA8WrQ12R0dR9cuhEbbnltMXSauwrsndIf4egJVzJs3BM12jXEx+E6wSlK8nUu3xpmY12WUkJOAWfWJ6rnE4XArIcmtNzfpJyZgFhNv2fKYRBTCgU0l4HLo2uIiQj8/aLT2gQeRUdARNn3QLBrITMN6rojo1vmWYnXhjWxeUoYVDj5+bsrqfbAtyzPm43WS+2RZ0T1Rr50+REl+jin0y108v04me7BluidN013oj+gLI73A86/qBgo08l5RwG2p+oOzf root@ip-172-31-9-173
Error:
[root@ip-172-31-9-173 ~]# ssh root@172.31.11.205
Permission denied (publickey).
Not sure what is missing here.
ssh amazon-ec2 aws
Can you actually ssh by providing the username and password? If not, then if you can access the file ensure you have an AllowUsers entry in /etc/ssh/sshd_config and also that you are allowing SSH access to the subnet at the top of that file. if you do amend the sshd_config remember to restart the SSH service.
â l0ckm4
Aug 13 at 12:32
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Trying to establish ssh connection between two ec2 instances. Copied Host A id_rsa.pub key to Host B's authorized_keys file
[root@ip-172-31-9-173 .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTTRSTwBClsq7/punxLQvq00Ba7iMZRbQKAQhC+GVuQFB2LfWk9Hsetu4CqHoGo4R4BJ/SW/4v+AfKlmQ/kA8WrQ12R0dR9cuhEbbnltMXSauwrsndIf4egJVzJs3BM12jXEx+E6wSlK8nUu3xpmY12WUkJOAWfWJ6rnE4XArIcmtNzfpJyZgFhNv2fKYRBTCgU0l4HLo2uIiQj8/aLT2gQeRUdARNn3QLBrITMN6rojo1vmWYnXhjWxeUoYVDj5+bsrqfbAtyzPm43WS+2RZ0T1Rr50+REl+jin0y108v04me7BluidN013oj+gLI73A86/qBgo08l5RwG2p+oOzf root@ip-172-31-9-173
[root@ip-172-31-11-205 .ssh]# cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTTRSTwBClsq7/punxLQvq00Ba7iMZRbQKAQhC+GVuQFB2LfWk9Hsetu4CqHoGo4R4BJ/SW/4v+AfKlmQ/kA8WrQ12R0dR9cuhEbbnltMXSauwrsndIf4egJVzJs3BM12jXEx+E6wSlK8nUu3xpmY12WUkJOAWfWJ6rnE4XArIcmtNzfpJyZgFhNv2fKYRBTCgU0l4HLo2uIiQj8/aLT2gQeRUdARNn3QLBrITMN6rojo1vmWYnXhjWxeUoYVDj5+bsrqfbAtyzPm43WS+2RZ0T1Rr50+REl+jin0y108v04me7BluidN013oj+gLI73A86/qBgo08l5RwG2p+oOzf root@ip-172-31-9-173
Error:
[root@ip-172-31-9-173 ~]# ssh root@172.31.11.205
Permission denied (publickey).
Not sure what is missing here.
ssh amazon-ec2 aws
Trying to establish ssh connection between two ec2 instances. Copied Host A id_rsa.pub key to Host B's authorized_keys file
[root@ip-172-31-9-173 .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTTRSTwBClsq7/punxLQvq00Ba7iMZRbQKAQhC+GVuQFB2LfWk9Hsetu4CqHoGo4R4BJ/SW/4v+AfKlmQ/kA8WrQ12R0dR9cuhEbbnltMXSauwrsndIf4egJVzJs3BM12jXEx+E6wSlK8nUu3xpmY12WUkJOAWfWJ6rnE4XArIcmtNzfpJyZgFhNv2fKYRBTCgU0l4HLo2uIiQj8/aLT2gQeRUdARNn3QLBrITMN6rojo1vmWYnXhjWxeUoYVDj5+bsrqfbAtyzPm43WS+2RZ0T1Rr50+REl+jin0y108v04me7BluidN013oj+gLI73A86/qBgo08l5RwG2p+oOzf root@ip-172-31-9-173
[root@ip-172-31-11-205 .ssh]# cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTTRSTwBClsq7/punxLQvq00Ba7iMZRbQKAQhC+GVuQFB2LfWk9Hsetu4CqHoGo4R4BJ/SW/4v+AfKlmQ/kA8WrQ12R0dR9cuhEbbnltMXSauwrsndIf4egJVzJs3BM12jXEx+E6wSlK8nUu3xpmY12WUkJOAWfWJ6rnE4XArIcmtNzfpJyZgFhNv2fKYRBTCgU0l4HLo2uIiQj8/aLT2gQeRUdARNn3QLBrITMN6rojo1vmWYnXhjWxeUoYVDj5+bsrqfbAtyzPm43WS+2RZ0T1Rr50+REl+jin0y108v04me7BluidN013oj+gLI73A86/qBgo08l5RwG2p+oOzf root@ip-172-31-9-173
Error:
[root@ip-172-31-9-173 ~]# ssh root@172.31.11.205
Permission denied (publickey).
Not sure what is missing here.
ssh amazon-ec2 aws
ssh amazon-ec2 aws
edited Aug 13 at 8:12
asked Aug 13 at 8:04
Su_scriptingbee
3817
3817
Can you actually ssh by providing the username and password? If not, then if you can access the file ensure you have an AllowUsers entry in /etc/ssh/sshd_config and also that you are allowing SSH access to the subnet at the top of that file. if you do amend the sshd_config remember to restart the SSH service.
â l0ckm4
Aug 13 at 12:32
add a comment |Â
Can you actually ssh by providing the username and password? If not, then if you can access the file ensure you have an AllowUsers entry in /etc/ssh/sshd_config and also that you are allowing SSH access to the subnet at the top of that file. if you do amend the sshd_config remember to restart the SSH service.
â l0ckm4
Aug 13 at 12:32
Can you actually ssh by providing the username and password? If not, then if you can access the file ensure you have an AllowUsers entry in /etc/ssh/sshd_config and also that you are allowing SSH access to the subnet at the top of that file. if you do amend the sshd_config remember to restart the SSH service.
â l0ckm4
Aug 13 at 12:32
Can you actually ssh by providing the username and password? If not, then if you can access the file ensure you have an AllowUsers entry in /etc/ssh/sshd_config and also that you are allowing SSH access to the subnet at the top of that file. if you do amend the sshd_config remember to restart the SSH service.
â l0ckm4
Aug 13 at 12:32
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
You are missing the private key id_rsa in the machine initiating the connection to the 2nd machine.
Place it on /root/.ssh/id_rsa if doing it as root. Also do not forget that SSH is picky about rights, so you have to do:
chmod 700 /root/.ssh
chmod 600 /root/.ssh/id_rsa
On the long term, consider not working as root, and using a regular user.
It's not working with those permissions too.
â Su_scriptingbee
Aug 17 at 7:54
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You are missing the private key id_rsa in the machine initiating the connection to the 2nd machine.
Place it on /root/.ssh/id_rsa if doing it as root. Also do not forget that SSH is picky about rights, so you have to do:
chmod 700 /root/.ssh
chmod 600 /root/.ssh/id_rsa
On the long term, consider not working as root, and using a regular user.
It's not working with those permissions too.
â Su_scriptingbee
Aug 17 at 7:54
add a comment |Â
up vote
0
down vote
You are missing the private key id_rsa in the machine initiating the connection to the 2nd machine.
Place it on /root/.ssh/id_rsa if doing it as root. Also do not forget that SSH is picky about rights, so you have to do:
chmod 700 /root/.ssh
chmod 600 /root/.ssh/id_rsa
On the long term, consider not working as root, and using a regular user.
It's not working with those permissions too.
â Su_scriptingbee
Aug 17 at 7:54
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You are missing the private key id_rsa in the machine initiating the connection to the 2nd machine.
Place it on /root/.ssh/id_rsa if doing it as root. Also do not forget that SSH is picky about rights, so you have to do:
chmod 700 /root/.ssh
chmod 600 /root/.ssh/id_rsa
On the long term, consider not working as root, and using a regular user.
You are missing the private key id_rsa in the machine initiating the connection to the 2nd machine.
Place it on /root/.ssh/id_rsa if doing it as root. Also do not forget that SSH is picky about rights, so you have to do:
chmod 700 /root/.ssh
chmod 600 /root/.ssh/id_rsa
On the long term, consider not working as root, and using a regular user.
answered Aug 13 at 12:44
Rui F Ribeiro
36.6k1271116
36.6k1271116
It's not working with those permissions too.
â Su_scriptingbee
Aug 17 at 7:54
add a comment |Â
It's not working with those permissions too.
â Su_scriptingbee
Aug 17 at 7:54
It's not working with those permissions too.
â Su_scriptingbee
Aug 17 at 7:54
It's not working with those permissions too.
â Su_scriptingbee
Aug 17 at 7:54
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f462235%2funable-to-establish-ssh-connection-between-two-ami-ec2-instances%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Can you actually ssh by providing the username and password? If not, then if you can access the file ensure you have an AllowUsers entry in /etc/ssh/sshd_config and also that you are allowing SSH access to the subnet at the top of that file. if you do amend the sshd_config remember to restart the SSH service.
â l0ckm4
Aug 13 at 12:32