Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Need to SSH to my AWS Ubuntu server from Mac Terminal

Need to SSH to my AWS Ubuntu server from Mac Terminal

I opened Terminal, executed
sudo su (to become super user)

changed directories so that my current folder shows my KeyPair1.pem file and when I execute

ls - l

I see my .pem file has the following permissions:

-r--------@

please explain this. It's Read access for who exactly?

I ran "chmod 400 KeyPair1.pem" as a way to protect the file from being over-written, Is this the correct thing to do?


I have the IP address of my Ubuntu server:

I execute the same command provided by AWS, but find the terminal locks. I am forced to press Ctrl+C to get the cursor again:

ssh -i "KeyPair1.pem" ubuntu@1.2.3.4

Does anyone see what's wrong?

When I type ssh <ENTER> I get:
usage: ssh [-46******************Yy] [-B bind_interface]
           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
           [-i identity_file] [-J [user@]host[:port]] [-L address]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-Q query_option] [-R address] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] destination [command]

Does this mean SSH is installed?

Is there a way to see what variant of SSH is installed?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Kenza Cohen
Kenza Cohen
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Usually, aws ssh is secured with an rsa/dsa to avoid username/password type of authentication.

Make sure your .pem files does not contain both the public and the private key.

commnly, the private key you would store as id_dsa or id_rsa

Use -vvvv to enable debug

ssh -vvvvv username@remoteip -P port if different than 22
Avatar of curiouswebster

ASKER

I get the same result. It hangs.

I assume public_dns_name is my IP address on AWS?

Ahh, I do not think I made it public.

Let me check that.
Telnet ip 22
See if you get a connection.
Yes, I had made it private for some reason. I see no values under Public IP. Know how I can fix that?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That worked. Can I ask?

What is this:

ECDSA key fingerprint is SHA256:Lq***************OYY/3w8r/W/s******yJM/s.

and is the period at the end part of the key??
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I opened Terminal, executed
sudo su (to become super user)

That's unnecessary to do ssh.  sudo su is also a redundant command.


ECDSA key fingerprint is SHA256:Lq***************OYY/3w8r/W/s******yJM/s.

That is the fingerprint of the remote server.  It's used for you to verify that you're connecting to the correct system.  It's a hash of its public key.

To get the remote key fingerprint:
ssh-keyscan <IP>

On the server, you get the fingerprint from the public key:
ssh-keygen -lf <public_key_file>