Add ssh key in existing droplet - digital-ocean

I am a new to use a digital ocean....
Unfortunately I am facing a problem when
I have a current (existing) droplet in which I need to add my ssh key? (DigitalOcean)
Can i update a droplet? | DigitalOcean

Edit and Add your new SSH key in authorized_keys file of .ssh directory, which is located in user directory.
then run following command
sudo service ssh restart
Then try to connect using ssh username#your_droplet_ipaddress
I hope it works

Related

Is it possible to set up SSH to Google Cloud Platform VM just with user and password (no private/public keys)?

I have to set up ssh connection to VM on Google Cloud Platform that won't requiere any keys, just username and password. Is that possible?
To enable SSH password authentication on Compute Engine instances, you must edit the sshd_config file, to do that first go to your instance by clicking on the “SSH” button next to the instance name on Cloud Console.
Then a terminal appears and you should be able to edit the config file using: sudo nano /etc/ssh/sshd_config
Then, change the line: PasswordAuthentication no to PasswordAuthentication yes
Also, if you need to have directly root ssh access with username/password authentication, also change the line: PermitRootLogin no to PermitRootLogin yes
After making that changes, restart the SSH service by running the following command:
1.- If your OS is Ubuntu/Debian: sudo service ssh restart
2.- If your OS is CentOS/RedHat: sudo service sshd restart
Now you should be able to login with username/password authentication.

AWS EC2 instance - Can access instance using old ssh key even after changing it

Recently, I had to change ssh key of my EC2 instance which i did using following steps:
Created new key-pair file from AWS
Connected to AWS using old ssh and then went to .ssh directory listed under root folder.
Opened authorized_keys file and deleted old key from there and added new PRIVATE key and then saved it.
Restarted ssh service.
Opened new terminal and tried to connect using new ssh key and it worked without any issue.
However, my problem is that when I tried to connect using old ssh which I just removed from authorized_keys file, I was able to connect to server which I did not want.
Can anybody explain me if I doing anything wrong here as I wanted to remove access of server via old ssh key and use only new ssh key?

How to get website directory in SSH

My domain is set up with AWS, and I connected it with an EC2 instance so I can use SSH to build it (nginx is installed). But when I connect to the SSH server and use the ls command, the directory that would be my site does not show up. I do know from experience that the site should show up as a directory from a friend's server I have access to. Another note, I am using Babun as the command line for SSH.

Cannot create an SSH tunnel to Zeppelin web display on aws, using Putty on windows

The following instructions are given for the ec2 instance that I'm trying to connect to:
To access your instance: Open an SSH client. (find out how to connect
using PuTTY)
CHECK!
Locate your private key file (keypair.pem). The wizard automatically
detects the key you used to launch the instance.
I launched Putty with a .ppk and I also still have the .pem sitting on my local machine. However, how does this help once I am in the aws Linux terminal?
It sounds to me that the .pem should now be located on the remote machine, not my local one.
Your key must not be publicly viewable for SSH to work. Use this
command if needed: chmod 400 keypair.pem
This is fine once the previous step is clearer.
Connect to your instance using its Public DNS:
ec2-xxxxxxxxxxxxx.eu-west-1.compute.amazonaws.com
Example: ssh -i "keypair.pem"
root#ec2-xxxxxxxxxxxxx.eu-west-1.compute.amazonaws.com
I am currently typing this in (also trying ec2-user instead of root) but I get the following:
Warning: Identity file keypair.pem not accessible: No such file or directory.
Permission denied (publickey).
Please note that in most cases the username above will be correct,
however please ensure that you read your AMI usage instructions to
ensure that the AMI owner has not changed the default AMI username.
In case this is important, what user name are they referring to here?
I have also made sure the I can SSH into the security group from all locations.
Christopher, I am not sure if you have access to the AWS console, but If you do, then it will be easy to find out the correct user name of your EC2 machine. click on the check mark box to pick your instance, then click Connect, and it will show you the correct user name. If it is an amazon AMI image, it will most likely be ec2-user, other images can have root, ubuntu, bitnami, or any other user configured by the AMI creator.
Your error message: " Warning: Identity file keypair.pem not accessible" indicates an issue with your private key not being accessible.
You said you converted the .pem to ppk for putty, which will enable you to SSH via putty. If you need to SSH from an EC2 machine to another EC2 machine, you will need that private key with the "pem" extension.
Think of your private key as your password, except that it's stored in a file.
ssh -i "keypair.pem" root#ec2-xxxxxxxxxxxxx.eu-west-1.compute.amazonaws.com
This command says: Log me in via SSH protocol to server xxxx.eu... using password file (Private key) "keypair.pem" that resides in the current directory.
if you do an "ls" and you don't see "keypair.pem" then that is your issue.
I hope that helps!

How do I SSH into EC2 with .pub?

When I create a new Elastic Beanstalk environment it asked me if wanted to create a new keypair. I say yes, and it created two file in my .ssh folder locally called app and app.pub. Normally to ssh into an instance I use a app.pem file.
i.e
ssh -i app.pem ubuntu#ip
Why did Elastic Beanstalk not give me pem file and how do I SSH into the instance without one?
It seems that you need to create your key first in the AWS console, this will allow you to download the correct file app.pem which you add to .ssh folder (Mac).
You can then resign the new key by doing eb ssh --setup. WARNING This deletes all instances and recreates!