AWS ssh access 'Permission denied (publickey)' issue [closed]
How to connect to a AWS instance through ssh?
I have:
- Signed up at AWS;
- Created a public key and a certificate at AWS website and saved them to disk;
Went to my console and created environment variables:
$ export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/
$ export EC2_CERT=/home/default/aws/cert-EBAINCRNWHDSCWWIHSOKON2YWGJZ5LSQ.pem
$ export EC2_PRIVATE_KEY=/home/default/aws/pk-EBAINCRNWHDSCWWIHSOKON2YWGJZ5LSQ.pemTold AWS API to use this keypair and saved the keypair to file:
$ ec2-add-keypair ec2-keypair > ec2-keypair.pem
Started an AWS Ubuntu 9 instance using this keypair:
$ ec2-run-instances ami-ed46a784 -k ec2-keypair
Attempted to establish a ssh connection to the instance:
$ ssh -v -i ec2-keypair.pem ubuntu@ec2-174-129-185-190.compute-1.amazonaws.com
OpenSSH_5.1p1 Debian-5ubuntu1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to ec2-174-129-185-190.compute-1.amazonaws.com [174.129.185.190] port 22.
debug1: Connection established.
debug1: identity file ec2-keypair.pem type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.1p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ec2-174-129-185-190.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/default/.ssh/known_hosts:11
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: ec2-keypair.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).What could be the problem and how to make it work?
amazon-web-services ssh-keys
closed as off-topic by Flexo♦ Jan 22 '16 at 8:24
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Flexo
add a comment |
How to connect to a AWS instance through ssh?
I have:
- Signed up at AWS;
- Created a public key and a certificate at AWS website and saved them to disk;
Went to my console and created environment variables:
$ export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/
$ export EC2_CERT=/home/default/aws/cert-EBAINCRNWHDSCWWIHSOKON2YWGJZ5LSQ.pem
$ export EC2_PRIVATE_KEY=/home/default/aws/pk-EBAINCRNWHDSCWWIHSOKON2YWGJZ5LSQ.pemTold AWS API to use this keypair and saved the keypair to file:
$ ec2-add-keypair ec2-keypair > ec2-keypair.pem
Started an AWS Ubuntu 9 instance using this keypair:
$ ec2-run-instances ami-ed46a784 -k ec2-keypair
Attempted to establish a ssh connection to the instance:
$ ssh -v -i ec2-keypair.pem ubuntu@ec2-174-129-185-190.compute-1.amazonaws.com
OpenSSH_5.1p1 Debian-5ubuntu1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to ec2-174-129-185-190.compute-1.amazonaws.com [174.129.185.190] port 22.
debug1: Connection established.
debug1: identity file ec2-keypair.pem type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.1p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ec2-174-129-185-190.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/default/.ssh/known_hosts:11
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: ec2-keypair.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).What could be the problem and how to make it work?
amazon-web-services ssh-keys
closed as off-topic by Flexo♦ Jan 22 '16 at 8:24
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Flexo
2
Ironic is that I use "root" as user name but "ubuntu" (what you mentioned) is the right name for my AMI, and thank you for your post!
– realjin
Feb 15 '12 at 14:33
possible duplicate of Permission denied (publickey) when SSH Access to Amazon EC2 instance
– CtheGood
Jul 29 '15 at 15:36
add a comment |
How to connect to a AWS instance through ssh?
I have:
- Signed up at AWS;
- Created a public key and a certificate at AWS website and saved them to disk;
Went to my console and created environment variables:
$ export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/
$ export EC2_CERT=/home/default/aws/cert-EBAINCRNWHDSCWWIHSOKON2YWGJZ5LSQ.pem
$ export EC2_PRIVATE_KEY=/home/default/aws/pk-EBAINCRNWHDSCWWIHSOKON2YWGJZ5LSQ.pemTold AWS API to use this keypair and saved the keypair to file:
$ ec2-add-keypair ec2-keypair > ec2-keypair.pem
Started an AWS Ubuntu 9 instance using this keypair:
$ ec2-run-instances ami-ed46a784 -k ec2-keypair
Attempted to establish a ssh connection to the instance:
$ ssh -v -i ec2-keypair.pem ubuntu@ec2-174-129-185-190.compute-1.amazonaws.com
OpenSSH_5.1p1 Debian-5ubuntu1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to ec2-174-129-185-190.compute-1.amazonaws.com [174.129.185.190] port 22.
debug1: Connection established.
debug1: identity file ec2-keypair.pem type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.1p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ec2-174-129-185-190.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/default/.ssh/known_hosts:11
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: ec2-keypair.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).What could be the problem and how to make it work?
amazon-web-services ssh-keys
How to connect to a AWS instance through ssh?
I have:
- Signed up at AWS;
- Created a public key and a certificate at AWS website and saved them to disk;
Went to my console and created environment variables:
$ export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/
$ export EC2_CERT=/home/default/aws/cert-EBAINCRNWHDSCWWIHSOKON2YWGJZ5LSQ.pem
$ export EC2_PRIVATE_KEY=/home/default/aws/pk-EBAINCRNWHDSCWWIHSOKON2YWGJZ5LSQ.pemTold AWS API to use this keypair and saved the keypair to file:
$ ec2-add-keypair ec2-keypair > ec2-keypair.pem
Started an AWS Ubuntu 9 instance using this keypair:
$ ec2-run-instances ami-ed46a784 -k ec2-keypair
Attempted to establish a ssh connection to the instance:
$ ssh -v -i ec2-keypair.pem ubuntu@ec2-174-129-185-190.compute-1.amazonaws.com
OpenSSH_5.1p1 Debian-5ubuntu1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to ec2-174-129-185-190.compute-1.amazonaws.com [174.129.185.190] port 22.
debug1: Connection established.
debug1: identity file ec2-keypair.pem type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.1p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ec2-174-129-185-190.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/default/.ssh/known_hosts:11
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: ec2-keypair.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).What could be the problem and how to make it work?
amazon-web-services ssh-keys
amazon-web-services ssh-keys
edited Jul 11 '13 at 17:08
JJD
25.7k36154255
25.7k36154255
asked Sep 21 '09 at 13:54
AlexAlex
14.6k3988120
14.6k3988120
closed as off-topic by Flexo♦ Jan 22 '16 at 8:24
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Flexo
closed as off-topic by Flexo♦ Jan 22 '16 at 8:24
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Flexo
2
Ironic is that I use "root" as user name but "ubuntu" (what you mentioned) is the right name for my AMI, and thank you for your post!
– realjin
Feb 15 '12 at 14:33
possible duplicate of Permission denied (publickey) when SSH Access to Amazon EC2 instance
– CtheGood
Jul 29 '15 at 15:36
add a comment |
2
Ironic is that I use "root" as user name but "ubuntu" (what you mentioned) is the right name for my AMI, and thank you for your post!
– realjin
Feb 15 '12 at 14:33
possible duplicate of Permission denied (publickey) when SSH Access to Amazon EC2 instance
– CtheGood
Jul 29 '15 at 15:36
2
2
Ironic is that I use "root" as user name but "ubuntu" (what you mentioned) is the right name for my AMI, and thank you for your post!
– realjin
Feb 15 '12 at 14:33
Ironic is that I use "root" as user name but "ubuntu" (what you mentioned) is the right name for my AMI, and thank you for your post!
– realjin
Feb 15 '12 at 14:33
possible duplicate of Permission denied (publickey) when SSH Access to Amazon EC2 instance
– CtheGood
Jul 29 '15 at 15:36
possible duplicate of Permission denied (publickey) when SSH Access to Amazon EC2 instance
– CtheGood
Jul 29 '15 at 15:36
add a comment |
20 Answers
20
active
oldest
votes
For Ubuntu instances:
chmod 600 ec2-keypair.pem
ssh -v -i ec2-keypair.pem ubuntu@ec2-174-129-185-190.compute-1.amazonaws.com
For other instances, you might have to use ec2-user
instead of ubuntu
.
Most EC2 Linux images I've used only have the root user created by default.
See also: http://www.youtube.com/watch?v=WBro0TEAd7g
6
You rock! So darn simple!
– Alex
Sep 21 '09 at 14:01
49
You can also use ssh-add ec2-keypair.pem so you can drop the -i option
– AdamK
Sep 21 '09 at 15:27
12
if you try root and you get "Please login as the ec2-user user rather than root user.'" use ec2-user in place of root.
– Tony
Jun 24 '11 at 11:27
8
And some Ubuntu images seem to have the "ubuntu" user only. (Which can sudo to root.)
– Prof. Falken
Apr 26 '12 at 8:50
1
Super, super useful.
– NSCoder
Nov 14 '15 at 5:00
|
show 13 more comments
Now it's:
ssh -v -i ec2-keypair.pem ec2-user@[yourdnsaddress]
Thanks. It took me ages to find this out - it's not mentioned in the connect info from the console! It does tell you when you try to use root, but I thought ec2-user was a reference to my username. Doh!
– Adrian Mouat
Jan 13 '12 at 16:37
1
Oh man. Not an easy tidbit to find. Thanks!
– vroomfondel
Aug 24 '13 at 6:06
thanks , not easy ti find this one
– user762579
Jan 20 '15 at 18:10
Very good! Thank you!
– Viana
Jan 26 '16 at 13:58
add a comment |
Canonical's releases use the user 'ubuntu' by default for anyone landing here with a ubuntu image that is coming up with the same problem.
2
Not easy to find this one out.
– Gustav
Mar 25 '12 at 16:29
add a comment |
If you're using a Bitnami image, log in as 'bitnami'.
Seems obvious, but something I overlooked.
Your answer saved my day!
– Surya
Sep 26 '13 at 19:54
2
Did you mean?Seems <sarcasm>obvious</sarcasm>
– Bob Stein
Nov 9 '15 at 20:11
Bitnami instructions, including how to find the database passwords.
– Bob Stein
Nov 9 '15 at 20:49
add a comment |
For my ubuntu images, it is actually ubuntu user and NOT the ec2-user ;)
add a comment |
Ubuntu 10.04 with openSSH
this is the exact usage:
ssh -v -i [yourkeypairfile] ec2-user@[yourdnsaddress]
for example:
ssh -v -i GSG_Keypair.pem ec2-user@ec2-184-72-204-112.compute-1.amazonaws.com
above example was taken directly from the AWS tutorial for connecting to a Linux/UNIX machine at:
http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/
With ssh -i switch we can use .pem file only.
– ABHAY JOHRI
Dec 18 '17 at 14:12
add a comment |
It will also complain if the pem file permissions are too open. chmod the file to 600 to fix that.
Thanks for this tip - helped me a lot
– Billy Moon
Sep 25 '12 at 20:32
4
For novices.. the command to do this would be:chmod 600 your_file.pem
– Evildonald
Jan 28 '13 at 0:11
add a comment |
I was also running into this - turns out I was using a community-created AMI - and the default username was niehter root, nor was it ect-user or ubuntu. In fact, I had no idea what it was - till I tried 'root' and the server kindly asked me to login as xxx where xxx is whatever it tells you.
-cheers!
add a comment |
use...
# chmod 400 ec2-keypair.pem
don't use the 600 permission otherwise you might overwrite your key accidently.
add a comment |
You need have your private key in your local machine
You need to know the IP address or DNS name of your remote machine or server, you can get this from AWS console
If you are a linux user
- Make sure the permissions on the private key are 600
(chmod 600 <path to private key file>
) - Connect to your machine using ssh
(ssh -i <path to private key file> <user>@<IP address or DNS name of remote server>
)
If you are a windows user
- Use PuTTy to create the ssh session (http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.66-installer.exe)
- If your private key file is in .pem format convert it into .ppk using puttygen
- Launch PuTTy, set you ppk file, IP address or DNS name of the remote server and start the ssh session
Change the permission of the file using chmod 400 <pem key>
– Vaibhav Jain
Jun 2 '16 at 13:19
add a comment |
this worked for me:
ssh-keygen -R <server_IP>
to delete the old keys stored on the workstation
also works with instead of
then doing the same ssh again it worked:
ssh -v -i <your_pem_file> ubuntu@<server_IP>
on ubuntu instances the username is: ubuntu
on Amazon Linux AMI the username is: ec2-user
I didn't have to re-create the instance from an image.
add a comment |
For Debian EC2 instances, the user is admin
.
add a comment |
If you are using EBS, you can also try to mount the EBS Volume on a running instance. Then mount it on that running instance and see what's going on in /home. You can see things like is the user ubuntu or ec2-user ? or does it have the right public keys under ~/.ssh/authorized_keys
add a comment |
If you are running AWS image from Bitnami. The username would be bitnami. Cheers!
see my debug and look at the last one:
*
ssh -v -i awsliferaysrta.pem.txt root@54.254.250.***
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to 54.254.250.*** [54.254.250.***] port 22.
debug1: Connection established.
debug1: identity file awsliferaysrta.pem.txt type -1
debug1: identity file awsliferaysrta.pem.txt-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 05:5c:78:45:c9:39:3a:84:fe:f8:19:5d:31:48:aa:5f
debug1: Host '54.254.250.***' is known and matches the RSA host key.
debug1: Found key in /Users/macbookpro/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: awsliferaysrta.pem.txt
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to 54.254.250.*** ([54.254.250.***]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Remote: Port forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Forced command.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Please login as the user "bitnami" rather than the user "root".
*
add a comment |
In my case (Mac OS X), the problem was the file's break type. Try this:
1.- Open the .pem file with TextWrangler
2.- At Bottom of app, verify if the Break Type is "Windows(CRLF)".
add a comment |
Its ec2-user for Amazon Linux AMI's and ubuntu for Ubuntu images.
Also, RHEL 6.4 and later ec2-user
RHEL 6.3 and earlier root
Fedora ec2-user
Centos root
add a comment |
Just adding to this list. I was having trouble this morning with a new user just added to an AWS EC2 instance. To cut to the chase, the problem was selinux (which was in enforcing mode), together with the fact that my user home dir was on a new EBS attached volume. Somehow I guess selinux doesn't like that other volume. Took me a while to figure out, as I looked through all the other usual ssh issues (/etc/ssh/sshd_config was fine, of course no password allowed, permissions were right, etc.)
The fix?
For now (until I understand how to allow a user to ssh to a different volume, or somehow make that volume a bona fide home dir point):
sudo perl -pi -e 's/^SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
sudo setenforce 0
That's it. Now my new user can log in, using his own id_rsa key.
add a comment |
Had the same issue. Permission denied (publickey) when trying to login in with 'ec2-user' or with 'root'.
Googled the AMI number of the machine image and it had the SSH login information right their on the Debian wiki page.
Hope this helps.
add a comment |
Permission for ec2-keypair.pem
should be 400
chmod 400 ec2-keypair.pem
add a comment |
There are 2 steps to be connected:
Chmod 400 on your private key, like this the others cannot access to your key:
chmod 400 toto.pem
To connect to your instance in SSH, you need to know the public IP address of your instance :
ssh -i toto.pem ec2-user@XX.XX.XX.XXX
Hope it helps !
add a comment |
20 Answers
20
active
oldest
votes
20 Answers
20
active
oldest
votes
active
oldest
votes
active
oldest
votes
For Ubuntu instances:
chmod 600 ec2-keypair.pem
ssh -v -i ec2-keypair.pem ubuntu@ec2-174-129-185-190.compute-1.amazonaws.com
For other instances, you might have to use ec2-user
instead of ubuntu
.
Most EC2 Linux images I've used only have the root user created by default.
See also: http://www.youtube.com/watch?v=WBro0TEAd7g
6
You rock! So darn simple!
– Alex
Sep 21 '09 at 14:01
49
You can also use ssh-add ec2-keypair.pem so you can drop the -i option
– AdamK
Sep 21 '09 at 15:27
12
if you try root and you get "Please login as the ec2-user user rather than root user.'" use ec2-user in place of root.
– Tony
Jun 24 '11 at 11:27
8
And some Ubuntu images seem to have the "ubuntu" user only. (Which can sudo to root.)
– Prof. Falken
Apr 26 '12 at 8:50
1
Super, super useful.
– NSCoder
Nov 14 '15 at 5:00
|
show 13 more comments
For Ubuntu instances:
chmod 600 ec2-keypair.pem
ssh -v -i ec2-keypair.pem ubuntu@ec2-174-129-185-190.compute-1.amazonaws.com
For other instances, you might have to use ec2-user
instead of ubuntu
.
Most EC2 Linux images I've used only have the root user created by default.
See also: http://www.youtube.com/watch?v=WBro0TEAd7g
6
You rock! So darn simple!
– Alex
Sep 21 '09 at 14:01
49
You can also use ssh-add ec2-keypair.pem so you can drop the -i option
– AdamK
Sep 21 '09 at 15:27
12
if you try root and you get "Please login as the ec2-user user rather than root user.'" use ec2-user in place of root.
– Tony
Jun 24 '11 at 11:27
8
And some Ubuntu images seem to have the "ubuntu" user only. (Which can sudo to root.)
– Prof. Falken
Apr 26 '12 at 8:50
1
Super, super useful.
– NSCoder
Nov 14 '15 at 5:00
|
show 13 more comments
For Ubuntu instances:
chmod 600 ec2-keypair.pem
ssh -v -i ec2-keypair.pem ubuntu@ec2-174-129-185-190.compute-1.amazonaws.com
For other instances, you might have to use ec2-user
instead of ubuntu
.
Most EC2 Linux images I've used only have the root user created by default.
See also: http://www.youtube.com/watch?v=WBro0TEAd7g
For Ubuntu instances:
chmod 600 ec2-keypair.pem
ssh -v -i ec2-keypair.pem ubuntu@ec2-174-129-185-190.compute-1.amazonaws.com
For other instances, you might have to use ec2-user
instead of ubuntu
.
Most EC2 Linux images I've used only have the root user created by default.
See also: http://www.youtube.com/watch?v=WBro0TEAd7g
edited Apr 22 '13 at 1:45
Dave Jarvis
21.2k30132256
21.2k30132256
answered Sep 21 '09 at 13:58
sipwizsipwiz
23.1k2085138
23.1k2085138
6
You rock! So darn simple!
– Alex
Sep 21 '09 at 14:01
49
You can also use ssh-add ec2-keypair.pem so you can drop the -i option
– AdamK
Sep 21 '09 at 15:27
12
if you try root and you get "Please login as the ec2-user user rather than root user.'" use ec2-user in place of root.
– Tony
Jun 24 '11 at 11:27
8
And some Ubuntu images seem to have the "ubuntu" user only. (Which can sudo to root.)
– Prof. Falken
Apr 26 '12 at 8:50
1
Super, super useful.
– NSCoder
Nov 14 '15 at 5:00
|
show 13 more comments
6
You rock! So darn simple!
– Alex
Sep 21 '09 at 14:01
49
You can also use ssh-add ec2-keypair.pem so you can drop the -i option
– AdamK
Sep 21 '09 at 15:27
12
if you try root and you get "Please login as the ec2-user user rather than root user.'" use ec2-user in place of root.
– Tony
Jun 24 '11 at 11:27
8
And some Ubuntu images seem to have the "ubuntu" user only. (Which can sudo to root.)
– Prof. Falken
Apr 26 '12 at 8:50
1
Super, super useful.
– NSCoder
Nov 14 '15 at 5:00
6
6
You rock! So darn simple!
– Alex
Sep 21 '09 at 14:01
You rock! So darn simple!
– Alex
Sep 21 '09 at 14:01
49
49
You can also use ssh-add ec2-keypair.pem so you can drop the -i option
– AdamK
Sep 21 '09 at 15:27
You can also use ssh-add ec2-keypair.pem so you can drop the -i option
– AdamK
Sep 21 '09 at 15:27
12
12
if you try root and you get "Please login as the ec2-user user rather than root user.'" use ec2-user in place of root.
– Tony
Jun 24 '11 at 11:27
if you try root and you get "Please login as the ec2-user user rather than root user.'" use ec2-user in place of root.
– Tony
Jun 24 '11 at 11:27
8
8
And some Ubuntu images seem to have the "ubuntu" user only. (Which can sudo to root.)
– Prof. Falken
Apr 26 '12 at 8:50
And some Ubuntu images seem to have the "ubuntu" user only. (Which can sudo to root.)
– Prof. Falken
Apr 26 '12 at 8:50
1
1
Super, super useful.
– NSCoder
Nov 14 '15 at 5:00
Super, super useful.
– NSCoder
Nov 14 '15 at 5:00
|
show 13 more comments
Now it's:
ssh -v -i ec2-keypair.pem ec2-user@[yourdnsaddress]
Thanks. It took me ages to find this out - it's not mentioned in the connect info from the console! It does tell you when you try to use root, but I thought ec2-user was a reference to my username. Doh!
– Adrian Mouat
Jan 13 '12 at 16:37
1
Oh man. Not an easy tidbit to find. Thanks!
– vroomfondel
Aug 24 '13 at 6:06
thanks , not easy ti find this one
– user762579
Jan 20 '15 at 18:10
Very good! Thank you!
– Viana
Jan 26 '16 at 13:58
add a comment |
Now it's:
ssh -v -i ec2-keypair.pem ec2-user@[yourdnsaddress]
Thanks. It took me ages to find this out - it's not mentioned in the connect info from the console! It does tell you when you try to use root, but I thought ec2-user was a reference to my username. Doh!
– Adrian Mouat
Jan 13 '12 at 16:37
1
Oh man. Not an easy tidbit to find. Thanks!
– vroomfondel
Aug 24 '13 at 6:06
thanks , not easy ti find this one
– user762579
Jan 20 '15 at 18:10
Very good! Thank you!
– Viana
Jan 26 '16 at 13:58
add a comment |
Now it's:
ssh -v -i ec2-keypair.pem ec2-user@[yourdnsaddress]
Now it's:
ssh -v -i ec2-keypair.pem ec2-user@[yourdnsaddress]
edited Jul 3 '12 at 17:31
Tim Cooper
120k32242229
120k32242229
answered Dec 3 '10 at 3:03
SSHSSH
2,4751218
2,4751218
Thanks. It took me ages to find this out - it's not mentioned in the connect info from the console! It does tell you when you try to use root, but I thought ec2-user was a reference to my username. Doh!
– Adrian Mouat
Jan 13 '12 at 16:37
1
Oh man. Not an easy tidbit to find. Thanks!
– vroomfondel
Aug 24 '13 at 6:06
thanks , not easy ti find this one
– user762579
Jan 20 '15 at 18:10
Very good! Thank you!
– Viana
Jan 26 '16 at 13:58
add a comment |
Thanks. It took me ages to find this out - it's not mentioned in the connect info from the console! It does tell you when you try to use root, but I thought ec2-user was a reference to my username. Doh!
– Adrian Mouat
Jan 13 '12 at 16:37
1
Oh man. Not an easy tidbit to find. Thanks!
– vroomfondel
Aug 24 '13 at 6:06
thanks , not easy ti find this one
– user762579
Jan 20 '15 at 18:10
Very good! Thank you!
– Viana
Jan 26 '16 at 13:58
Thanks. It took me ages to find this out - it's not mentioned in the connect info from the console! It does tell you when you try to use root, but I thought ec2-user was a reference to my username. Doh!
– Adrian Mouat
Jan 13 '12 at 16:37
Thanks. It took me ages to find this out - it's not mentioned in the connect info from the console! It does tell you when you try to use root, but I thought ec2-user was a reference to my username. Doh!
– Adrian Mouat
Jan 13 '12 at 16:37
1
1
Oh man. Not an easy tidbit to find. Thanks!
– vroomfondel
Aug 24 '13 at 6:06
Oh man. Not an easy tidbit to find. Thanks!
– vroomfondel
Aug 24 '13 at 6:06
thanks , not easy ti find this one
– user762579
Jan 20 '15 at 18:10
thanks , not easy ti find this one
– user762579
Jan 20 '15 at 18:10
Very good! Thank you!
– Viana
Jan 26 '16 at 13:58
Very good! Thank you!
– Viana
Jan 26 '16 at 13:58
add a comment |
Canonical's releases use the user 'ubuntu' by default for anyone landing here with a ubuntu image that is coming up with the same problem.
2
Not easy to find this one out.
– Gustav
Mar 25 '12 at 16:29
add a comment |
Canonical's releases use the user 'ubuntu' by default for anyone landing here with a ubuntu image that is coming up with the same problem.
2
Not easy to find this one out.
– Gustav
Mar 25 '12 at 16:29
add a comment |
Canonical's releases use the user 'ubuntu' by default for anyone landing here with a ubuntu image that is coming up with the same problem.
Canonical's releases use the user 'ubuntu' by default for anyone landing here with a ubuntu image that is coming up with the same problem.
answered Nov 4 '10 at 2:59
bryon bryon
45142
45142
2
Not easy to find this one out.
– Gustav
Mar 25 '12 at 16:29
add a comment |
2
Not easy to find this one out.
– Gustav
Mar 25 '12 at 16:29
2
2
Not easy to find this one out.
– Gustav
Mar 25 '12 at 16:29
Not easy to find this one out.
– Gustav
Mar 25 '12 at 16:29
add a comment |
If you're using a Bitnami image, log in as 'bitnami'.
Seems obvious, but something I overlooked.
Your answer saved my day!
– Surya
Sep 26 '13 at 19:54
2
Did you mean?Seems <sarcasm>obvious</sarcasm>
– Bob Stein
Nov 9 '15 at 20:11
Bitnami instructions, including how to find the database passwords.
– Bob Stein
Nov 9 '15 at 20:49
add a comment |
If you're using a Bitnami image, log in as 'bitnami'.
Seems obvious, but something I overlooked.
Your answer saved my day!
– Surya
Sep 26 '13 at 19:54
2
Did you mean?Seems <sarcasm>obvious</sarcasm>
– Bob Stein
Nov 9 '15 at 20:11
Bitnami instructions, including how to find the database passwords.
– Bob Stein
Nov 9 '15 at 20:49
add a comment |
If you're using a Bitnami image, log in as 'bitnami'.
Seems obvious, but something I overlooked.
If you're using a Bitnami image, log in as 'bitnami'.
Seems obvious, but something I overlooked.
answered Dec 26 '11 at 4:13
akimakim
17125
17125
Your answer saved my day!
– Surya
Sep 26 '13 at 19:54
2
Did you mean?Seems <sarcasm>obvious</sarcasm>
– Bob Stein
Nov 9 '15 at 20:11
Bitnami instructions, including how to find the database passwords.
– Bob Stein
Nov 9 '15 at 20:49
add a comment |
Your answer saved my day!
– Surya
Sep 26 '13 at 19:54
2
Did you mean?Seems <sarcasm>obvious</sarcasm>
– Bob Stein
Nov 9 '15 at 20:11
Bitnami instructions, including how to find the database passwords.
– Bob Stein
Nov 9 '15 at 20:49
Your answer saved my day!
– Surya
Sep 26 '13 at 19:54
Your answer saved my day!
– Surya
Sep 26 '13 at 19:54
2
2
Did you mean?
Seems <sarcasm>obvious</sarcasm>
– Bob Stein
Nov 9 '15 at 20:11
Did you mean?
Seems <sarcasm>obvious</sarcasm>
– Bob Stein
Nov 9 '15 at 20:11
Bitnami instructions, including how to find the database passwords.
– Bob Stein
Nov 9 '15 at 20:49
Bitnami instructions, including how to find the database passwords.
– Bob Stein
Nov 9 '15 at 20:49
add a comment |
For my ubuntu images, it is actually ubuntu user and NOT the ec2-user ;)
add a comment |
For my ubuntu images, it is actually ubuntu user and NOT the ec2-user ;)
add a comment |
For my ubuntu images, it is actually ubuntu user and NOT the ec2-user ;)
For my ubuntu images, it is actually ubuntu user and NOT the ec2-user ;)
answered Oct 7 '11 at 23:11
Dean HillerDean Hiller
10.4k1586150
10.4k1586150
add a comment |
add a comment |
Ubuntu 10.04 with openSSH
this is the exact usage:
ssh -v -i [yourkeypairfile] ec2-user@[yourdnsaddress]
for example:
ssh -v -i GSG_Keypair.pem ec2-user@ec2-184-72-204-112.compute-1.amazonaws.com
above example was taken directly from the AWS tutorial for connecting to a Linux/UNIX machine at:
http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/
With ssh -i switch we can use .pem file only.
– ABHAY JOHRI
Dec 18 '17 at 14:12
add a comment |
Ubuntu 10.04 with openSSH
this is the exact usage:
ssh -v -i [yourkeypairfile] ec2-user@[yourdnsaddress]
for example:
ssh -v -i GSG_Keypair.pem ec2-user@ec2-184-72-204-112.compute-1.amazonaws.com
above example was taken directly from the AWS tutorial for connecting to a Linux/UNIX machine at:
http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/
With ssh -i switch we can use .pem file only.
– ABHAY JOHRI
Dec 18 '17 at 14:12
add a comment |
Ubuntu 10.04 with openSSH
this is the exact usage:
ssh -v -i [yourkeypairfile] ec2-user@[yourdnsaddress]
for example:
ssh -v -i GSG_Keypair.pem ec2-user@ec2-184-72-204-112.compute-1.amazonaws.com
above example was taken directly from the AWS tutorial for connecting to a Linux/UNIX machine at:
http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/
Ubuntu 10.04 with openSSH
this is the exact usage:
ssh -v -i [yourkeypairfile] ec2-user@[yourdnsaddress]
for example:
ssh -v -i GSG_Keypair.pem ec2-user@ec2-184-72-204-112.compute-1.amazonaws.com
above example was taken directly from the AWS tutorial for connecting to a Linux/UNIX machine at:
http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/
edited May 29 '11 at 4:44
answered May 28 '11 at 22:02
carl crottcarl crott
6301820
6301820
With ssh -i switch we can use .pem file only.
– ABHAY JOHRI
Dec 18 '17 at 14:12
add a comment |
With ssh -i switch we can use .pem file only.
– ABHAY JOHRI
Dec 18 '17 at 14:12
With ssh -i switch we can use .pem file only.
– ABHAY JOHRI
Dec 18 '17 at 14:12
With ssh -i switch we can use .pem file only.
– ABHAY JOHRI
Dec 18 '17 at 14:12
add a comment |
It will also complain if the pem file permissions are too open. chmod the file to 600 to fix that.
Thanks for this tip - helped me a lot
– Billy Moon
Sep 25 '12 at 20:32
4
For novices.. the command to do this would be:chmod 600 your_file.pem
– Evildonald
Jan 28 '13 at 0:11
add a comment |
It will also complain if the pem file permissions are too open. chmod the file to 600 to fix that.
Thanks for this tip - helped me a lot
– Billy Moon
Sep 25 '12 at 20:32
4
For novices.. the command to do this would be:chmod 600 your_file.pem
– Evildonald
Jan 28 '13 at 0:11
add a comment |
It will also complain if the pem file permissions are too open. chmod the file to 600 to fix that.
It will also complain if the pem file permissions are too open. chmod the file to 600 to fix that.
answered May 16 '12 at 2:28
Allan BoghAllan Bogh
375512
375512
Thanks for this tip - helped me a lot
– Billy Moon
Sep 25 '12 at 20:32
4
For novices.. the command to do this would be:chmod 600 your_file.pem
– Evildonald
Jan 28 '13 at 0:11
add a comment |
Thanks for this tip - helped me a lot
– Billy Moon
Sep 25 '12 at 20:32
4
For novices.. the command to do this would be:chmod 600 your_file.pem
– Evildonald
Jan 28 '13 at 0:11
Thanks for this tip - helped me a lot
– Billy Moon
Sep 25 '12 at 20:32
Thanks for this tip - helped me a lot
– Billy Moon
Sep 25 '12 at 20:32
4
4
For novices.. the command to do this would be:
chmod 600 your_file.pem
– Evildonald
Jan 28 '13 at 0:11
For novices.. the command to do this would be:
chmod 600 your_file.pem
– Evildonald
Jan 28 '13 at 0:11
add a comment |
I was also running into this - turns out I was using a community-created AMI - and the default username was niehter root, nor was it ect-user or ubuntu. In fact, I had no idea what it was - till I tried 'root' and the server kindly asked me to login as xxx where xxx is whatever it tells you.
-cheers!
add a comment |
I was also running into this - turns out I was using a community-created AMI - and the default username was niehter root, nor was it ect-user or ubuntu. In fact, I had no idea what it was - till I tried 'root' and the server kindly asked me to login as xxx where xxx is whatever it tells you.
-cheers!
add a comment |
I was also running into this - turns out I was using a community-created AMI - and the default username was niehter root, nor was it ect-user or ubuntu. In fact, I had no idea what it was - till I tried 'root' and the server kindly asked me to login as xxx where xxx is whatever it tells you.
-cheers!
I was also running into this - turns out I was using a community-created AMI - and the default username was niehter root, nor was it ect-user or ubuntu. In fact, I had no idea what it was - till I tried 'root' and the server kindly asked me to login as xxx where xxx is whatever it tells you.
-cheers!
answered Jul 12 '13 at 0:04
kevinfoundananswwerkevinfoundananswwer
411
411
add a comment |
add a comment |
use...
# chmod 400 ec2-keypair.pem
don't use the 600 permission otherwise you might overwrite your key accidently.
add a comment |
use...
# chmod 400 ec2-keypair.pem
don't use the 600 permission otherwise you might overwrite your key accidently.
add a comment |
use...
# chmod 400 ec2-keypair.pem
don't use the 600 permission otherwise you might overwrite your key accidently.
use...
# chmod 400 ec2-keypair.pem
don't use the 600 permission otherwise you might overwrite your key accidently.
edited Jun 2 '15 at 11:20
answered Feb 7 '14 at 10:29
x1b2jx1b2j
20213
20213
add a comment |
add a comment |
You need have your private key in your local machine
You need to know the IP address or DNS name of your remote machine or server, you can get this from AWS console
If you are a linux user
- Make sure the permissions on the private key are 600
(chmod 600 <path to private key file>
) - Connect to your machine using ssh
(ssh -i <path to private key file> <user>@<IP address or DNS name of remote server>
)
If you are a windows user
- Use PuTTy to create the ssh session (http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.66-installer.exe)
- If your private key file is in .pem format convert it into .ppk using puttygen
- Launch PuTTy, set you ppk file, IP address or DNS name of the remote server and start the ssh session
Change the permission of the file using chmod 400 <pem key>
– Vaibhav Jain
Jun 2 '16 at 13:19
add a comment |
You need have your private key in your local machine
You need to know the IP address or DNS name of your remote machine or server, you can get this from AWS console
If you are a linux user
- Make sure the permissions on the private key are 600
(chmod 600 <path to private key file>
) - Connect to your machine using ssh
(ssh -i <path to private key file> <user>@<IP address or DNS name of remote server>
)
If you are a windows user
- Use PuTTy to create the ssh session (http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.66-installer.exe)
- If your private key file is in .pem format convert it into .ppk using puttygen
- Launch PuTTy, set you ppk file, IP address or DNS name of the remote server and start the ssh session
Change the permission of the file using chmod 400 <pem key>
– Vaibhav Jain
Jun 2 '16 at 13:19
add a comment |
You need have your private key in your local machine
You need to know the IP address or DNS name of your remote machine or server, you can get this from AWS console
If you are a linux user
- Make sure the permissions on the private key are 600
(chmod 600 <path to private key file>
) - Connect to your machine using ssh
(ssh -i <path to private key file> <user>@<IP address or DNS name of remote server>
)
If you are a windows user
- Use PuTTy to create the ssh session (http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.66-installer.exe)
- If your private key file is in .pem format convert it into .ppk using puttygen
- Launch PuTTy, set you ppk file, IP address or DNS name of the remote server and start the ssh session
You need have your private key in your local machine
You need to know the IP address or DNS name of your remote machine or server, you can get this from AWS console
If you are a linux user
- Make sure the permissions on the private key are 600
(chmod 600 <path to private key file>
) - Connect to your machine using ssh
(ssh -i <path to private key file> <user>@<IP address or DNS name of remote server>
)
If you are a windows user
- Use PuTTy to create the ssh session (http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.66-installer.exe)
- If your private key file is in .pem format convert it into .ppk using puttygen
- Launch PuTTy, set you ppk file, IP address or DNS name of the remote server and start the ssh session
answered Jan 3 '16 at 12:36
Vineeth GunaVineeth Guna
330310
330310
Change the permission of the file using chmod 400 <pem key>
– Vaibhav Jain
Jun 2 '16 at 13:19
add a comment |
Change the permission of the file using chmod 400 <pem key>
– Vaibhav Jain
Jun 2 '16 at 13:19
Change the permission of the file using chmod 400 <pem key>
– Vaibhav Jain
Jun 2 '16 at 13:19
Change the permission of the file using chmod 400 <pem key>
– Vaibhav Jain
Jun 2 '16 at 13:19
add a comment |
this worked for me:
ssh-keygen -R <server_IP>
to delete the old keys stored on the workstation
also works with instead of
then doing the same ssh again it worked:
ssh -v -i <your_pem_file> ubuntu@<server_IP>
on ubuntu instances the username is: ubuntu
on Amazon Linux AMI the username is: ec2-user
I didn't have to re-create the instance from an image.
add a comment |
this worked for me:
ssh-keygen -R <server_IP>
to delete the old keys stored on the workstation
also works with instead of
then doing the same ssh again it worked:
ssh -v -i <your_pem_file> ubuntu@<server_IP>
on ubuntu instances the username is: ubuntu
on Amazon Linux AMI the username is: ec2-user
I didn't have to re-create the instance from an image.
add a comment |
this worked for me:
ssh-keygen -R <server_IP>
to delete the old keys stored on the workstation
also works with instead of
then doing the same ssh again it worked:
ssh -v -i <your_pem_file> ubuntu@<server_IP>
on ubuntu instances the username is: ubuntu
on Amazon Linux AMI the username is: ec2-user
I didn't have to re-create the instance from an image.
this worked for me:
ssh-keygen -R <server_IP>
to delete the old keys stored on the workstation
also works with instead of
then doing the same ssh again it worked:
ssh -v -i <your_pem_file> ubuntu@<server_IP>
on ubuntu instances the username is: ubuntu
on Amazon Linux AMI the username is: ec2-user
I didn't have to re-create the instance from an image.
answered Feb 4 '13 at 15:51
CrisCris
1,5641316
1,5641316
add a comment |
add a comment |
For Debian EC2 instances, the user is admin
.
add a comment |
For Debian EC2 instances, the user is admin
.
add a comment |
For Debian EC2 instances, the user is admin
.
For Debian EC2 instances, the user is admin
.
answered Feb 12 '14 at 8:22
Alastair IrvineAlastair Irvine
1,0011215
1,0011215
add a comment |
add a comment |
If you are using EBS, you can also try to mount the EBS Volume on a running instance. Then mount it on that running instance and see what's going on in /home. You can see things like is the user ubuntu or ec2-user ? or does it have the right public keys under ~/.ssh/authorized_keys
add a comment |
If you are using EBS, you can also try to mount the EBS Volume on a running instance. Then mount it on that running instance and see what's going on in /home. You can see things like is the user ubuntu or ec2-user ? or does it have the right public keys under ~/.ssh/authorized_keys
add a comment |
If you are using EBS, you can also try to mount the EBS Volume on a running instance. Then mount it on that running instance and see what's going on in /home. You can see things like is the user ubuntu or ec2-user ? or does it have the right public keys under ~/.ssh/authorized_keys
If you are using EBS, you can also try to mount the EBS Volume on a running instance. Then mount it on that running instance and see what's going on in /home. You can see things like is the user ubuntu or ec2-user ? or does it have the right public keys under ~/.ssh/authorized_keys
answered Dec 4 '13 at 23:29
RicoRico
28.6k95168
28.6k95168
add a comment |
add a comment |
If you are running AWS image from Bitnami. The username would be bitnami. Cheers!
see my debug and look at the last one:
*
ssh -v -i awsliferaysrta.pem.txt root@54.254.250.***
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to 54.254.250.*** [54.254.250.***] port 22.
debug1: Connection established.
debug1: identity file awsliferaysrta.pem.txt type -1
debug1: identity file awsliferaysrta.pem.txt-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 05:5c:78:45:c9:39:3a:84:fe:f8:19:5d:31:48:aa:5f
debug1: Host '54.254.250.***' is known and matches the RSA host key.
debug1: Found key in /Users/macbookpro/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: awsliferaysrta.pem.txt
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to 54.254.250.*** ([54.254.250.***]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Remote: Port forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Forced command.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Please login as the user "bitnami" rather than the user "root".
*
add a comment |
If you are running AWS image from Bitnami. The username would be bitnami. Cheers!
see my debug and look at the last one:
*
ssh -v -i awsliferaysrta.pem.txt root@54.254.250.***
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to 54.254.250.*** [54.254.250.***] port 22.
debug1: Connection established.
debug1: identity file awsliferaysrta.pem.txt type -1
debug1: identity file awsliferaysrta.pem.txt-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 05:5c:78:45:c9:39:3a:84:fe:f8:19:5d:31:48:aa:5f
debug1: Host '54.254.250.***' is known and matches the RSA host key.
debug1: Found key in /Users/macbookpro/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: awsliferaysrta.pem.txt
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to 54.254.250.*** ([54.254.250.***]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Remote: Port forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Forced command.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Please login as the user "bitnami" rather than the user "root".
*
add a comment |
If you are running AWS image from Bitnami. The username would be bitnami. Cheers!
see my debug and look at the last one:
*
ssh -v -i awsliferaysrta.pem.txt root@54.254.250.***
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to 54.254.250.*** [54.254.250.***] port 22.
debug1: Connection established.
debug1: identity file awsliferaysrta.pem.txt type -1
debug1: identity file awsliferaysrta.pem.txt-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 05:5c:78:45:c9:39:3a:84:fe:f8:19:5d:31:48:aa:5f
debug1: Host '54.254.250.***' is known and matches the RSA host key.
debug1: Found key in /Users/macbookpro/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: awsliferaysrta.pem.txt
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to 54.254.250.*** ([54.254.250.***]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Remote: Port forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Forced command.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Please login as the user "bitnami" rather than the user "root".
*
If you are running AWS image from Bitnami. The username would be bitnami. Cheers!
see my debug and look at the last one:
*
ssh -v -i awsliferaysrta.pem.txt root@54.254.250.***
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to 54.254.250.*** [54.254.250.***] port 22.
debug1: Connection established.
debug1: identity file awsliferaysrta.pem.txt type -1
debug1: identity file awsliferaysrta.pem.txt-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 05:5c:78:45:c9:39:3a:84:fe:f8:19:5d:31:48:aa:5f
debug1: Host '54.254.250.***' is known and matches the RSA host key.
debug1: Found key in /Users/macbookpro/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: awsliferaysrta.pem.txt
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to 54.254.250.*** ([54.254.250.***]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Remote: Port forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Forced command.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Please login as the user "bitnami" rather than the user "root".
*
answered Feb 25 '14 at 3:28
Hung DoHung Do
1113
1113
add a comment |
add a comment |
In my case (Mac OS X), the problem was the file's break type. Try this:
1.- Open the .pem file with TextWrangler
2.- At Bottom of app, verify if the Break Type is "Windows(CRLF)".
add a comment |
In my case (Mac OS X), the problem was the file's break type. Try this:
1.- Open the .pem file with TextWrangler
2.- At Bottom of app, verify if the Break Type is "Windows(CRLF)".
add a comment |
In my case (Mac OS X), the problem was the file's break type. Try this:
1.- Open the .pem file with TextWrangler
2.- At Bottom of app, verify if the Break Type is "Windows(CRLF)".
In my case (Mac OS X), the problem was the file's break type. Try this:
1.- Open the .pem file with TextWrangler
2.- At Bottom of app, verify if the Break Type is "Windows(CRLF)".
answered Aug 13 '15 at 15:36
pmartinezdpmartinezd
111
111
add a comment |
add a comment |
Its ec2-user for Amazon Linux AMI's and ubuntu for Ubuntu images.
Also, RHEL 6.4 and later ec2-user
RHEL 6.3 and earlier root
Fedora ec2-user
Centos root
add a comment |
Its ec2-user for Amazon Linux AMI's and ubuntu for Ubuntu images.
Also, RHEL 6.4 and later ec2-user
RHEL 6.3 and earlier root
Fedora ec2-user
Centos root
add a comment |
Its ec2-user for Amazon Linux AMI's and ubuntu for Ubuntu images.
Also, RHEL 6.4 and later ec2-user
RHEL 6.3 and earlier root
Fedora ec2-user
Centos root
Its ec2-user for Amazon Linux AMI's and ubuntu for Ubuntu images.
Also, RHEL 6.4 and later ec2-user
RHEL 6.3 and earlier root
Fedora ec2-user
Centos root
answered Aug 23 '15 at 13:09
Amith AjithAmith Ajith
148112
148112
add a comment |
add a comment |
Just adding to this list. I was having trouble this morning with a new user just added to an AWS EC2 instance. To cut to the chase, the problem was selinux (which was in enforcing mode), together with the fact that my user home dir was on a new EBS attached volume. Somehow I guess selinux doesn't like that other volume. Took me a while to figure out, as I looked through all the other usual ssh issues (/etc/ssh/sshd_config was fine, of course no password allowed, permissions were right, etc.)
The fix?
For now (until I understand how to allow a user to ssh to a different volume, or somehow make that volume a bona fide home dir point):
sudo perl -pi -e 's/^SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
sudo setenforce 0
That's it. Now my new user can log in, using his own id_rsa key.
add a comment |
Just adding to this list. I was having trouble this morning with a new user just added to an AWS EC2 instance. To cut to the chase, the problem was selinux (which was in enforcing mode), together with the fact that my user home dir was on a new EBS attached volume. Somehow I guess selinux doesn't like that other volume. Took me a while to figure out, as I looked through all the other usual ssh issues (/etc/ssh/sshd_config was fine, of course no password allowed, permissions were right, etc.)
The fix?
For now (until I understand how to allow a user to ssh to a different volume, or somehow make that volume a bona fide home dir point):
sudo perl -pi -e 's/^SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
sudo setenforce 0
That's it. Now my new user can log in, using his own id_rsa key.
add a comment |
Just adding to this list. I was having trouble this morning with a new user just added to an AWS EC2 instance. To cut to the chase, the problem was selinux (which was in enforcing mode), together with the fact that my user home dir was on a new EBS attached volume. Somehow I guess selinux doesn't like that other volume. Took me a while to figure out, as I looked through all the other usual ssh issues (/etc/ssh/sshd_config was fine, of course no password allowed, permissions were right, etc.)
The fix?
For now (until I understand how to allow a user to ssh to a different volume, or somehow make that volume a bona fide home dir point):
sudo perl -pi -e 's/^SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
sudo setenforce 0
That's it. Now my new user can log in, using his own id_rsa key.
Just adding to this list. I was having trouble this morning with a new user just added to an AWS EC2 instance. To cut to the chase, the problem was selinux (which was in enforcing mode), together with the fact that my user home dir was on a new EBS attached volume. Somehow I guess selinux doesn't like that other volume. Took me a while to figure out, as I looked through all the other usual ssh issues (/etc/ssh/sshd_config was fine, of course no password allowed, permissions were right, etc.)
The fix?
For now (until I understand how to allow a user to ssh to a different volume, or somehow make that volume a bona fide home dir point):
sudo perl -pi -e 's/^SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
sudo setenforce 0
That's it. Now my new user can log in, using his own id_rsa key.
answered Jun 13 '13 at 18:35
Pierre DPierre D
4,39742746
4,39742746
add a comment |
add a comment |
Had the same issue. Permission denied (publickey) when trying to login in with 'ec2-user' or with 'root'.
Googled the AMI number of the machine image and it had the SSH login information right their on the Debian wiki page.
Hope this helps.
add a comment |
Had the same issue. Permission denied (publickey) when trying to login in with 'ec2-user' or with 'root'.
Googled the AMI number of the machine image and it had the SSH login information right their on the Debian wiki page.
Hope this helps.
add a comment |
Had the same issue. Permission denied (publickey) when trying to login in with 'ec2-user' or with 'root'.
Googled the AMI number of the machine image and it had the SSH login information right their on the Debian wiki page.
Hope this helps.
Had the same issue. Permission denied (publickey) when trying to login in with 'ec2-user' or with 'root'.
Googled the AMI number of the machine image and it had the SSH login information right their on the Debian wiki page.
Hope this helps.
answered Sep 27 '13 at 3:36
Lionel MorrisonLionel Morrison
403411
403411
add a comment |
add a comment |
Permission for ec2-keypair.pem
should be 400
chmod 400 ec2-keypair.pem
add a comment |
Permission for ec2-keypair.pem
should be 400
chmod 400 ec2-keypair.pem
add a comment |
Permission for ec2-keypair.pem
should be 400
chmod 400 ec2-keypair.pem
Permission for ec2-keypair.pem
should be 400
chmod 400 ec2-keypair.pem
answered Jan 3 '14 at 6:24
YogiYogi
492613
492613
add a comment |
add a comment |
There are 2 steps to be connected:
Chmod 400 on your private key, like this the others cannot access to your key:
chmod 400 toto.pem
To connect to your instance in SSH, you need to know the public IP address of your instance :
ssh -i toto.pem ec2-user@XX.XX.XX.XXX
Hope it helps !
add a comment |
There are 2 steps to be connected:
Chmod 400 on your private key, like this the others cannot access to your key:
chmod 400 toto.pem
To connect to your instance in SSH, you need to know the public IP address of your instance :
ssh -i toto.pem ec2-user@XX.XX.XX.XXX
Hope it helps !
add a comment |
There are 2 steps to be connected:
Chmod 400 on your private key, like this the others cannot access to your key:
chmod 400 toto.pem
To connect to your instance in SSH, you need to know the public IP address of your instance :
ssh -i toto.pem ec2-user@XX.XX.XX.XXX
Hope it helps !
There are 2 steps to be connected:
Chmod 400 on your private key, like this the others cannot access to your key:
chmod 400 toto.pem
To connect to your instance in SSH, you need to know the public IP address of your instance :
ssh -i toto.pem ec2-user@XX.XX.XX.XXX
Hope it helps !
answered Feb 22 '15 at 23:46
GuillaumeAgisGuillaumeAgis
2,93311221
2,93311221
add a comment |
add a comment |
2
Ironic is that I use "root" as user name but "ubuntu" (what you mentioned) is the right name for my AMI, and thank you for your post!
– realjin
Feb 15 '12 at 14:33
possible duplicate of Permission denied (publickey) when SSH Access to Amazon EC2 instance
– CtheGood
Jul 29 '15 at 15:36