I have a following issue while connecting staging server using SSH cmd.
My cmd -> ssh hostaddress
Error -> root#host: Permission denied (publickey).
I have setup .ssh folder , and generated keygen keys as well.
Thanks in advance.
Related
We have an inhouse backup server (ubuntu) the inhouse server calls numerous remote servers using rsync. In order to set this up with a new website i need to ssh into the remote server and add my key to the authorized_keys file. Once i can login to the remote site via ssh from the backup server the rsync is then ran manually to build the structure (no reason for this but to confirm and to speed the backup up).
Today however I'm trying to add our newest website to the backup but the rsync command gives a 255 error and fails to connect due to a connection refused issue.
To confirm:
The remote server is lightsail with lampstack
We have multiple sites being backed up with lightsail and we use other servers too
Yes I can ssh into the remote site from on the backup server so key is correct and matches whats used in the rsync command
The rsync is generated and copied and pasted and has worked before
The .ssh folder on remote is 0700 and the authorised_keys is 600 and owner is bitnami
The pem file is in the correct folder /var/www/.ssh on backup server
The user I'm logged in as on the remote server when i run this is www-data (for ssh and rsync)
simplified rsyn command is:
rsync -rLDvvvcs -e "ssh -i /var/www/.ssh/LightsailKey.pem -p 22 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress --exclude-from '/path/to/exclude.txt' --delete --backup --backup-dir=/deleted_files/project-name/ --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r bitnami#{ip}:/home/bitnami/live/my-website/htdocs/ /mnt/incs/project-name/htdocs
Error from running this is
ssh: connect to host {ip} port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(235) [Receiver=3.1.2]
[Receiver] _exit_cleanup(code=12, file=io.c, line=235): about to call exit(255)
What am i missing with this?
thanks
Turned out it was a typo in the ip field in the database.
I have instance id, public DNS IP address, .pem file. I tried to connect to an EC2 instance using FileZilla but each time it fails saying could not authenticate (server: public key sent).
How can I connect using filezilla to EC2 instance?
I have tried putty too but it also gives an error and can't let me log in.
When tried using command line ssh -i My.pem root#ec2-myipaddress.us-west-2.compute.amazonaws.com it also gives error Permission denied (public key).
ssh -i My.pem root#ec2-myipaddress.us-west-2.compute.amazonaws.com
Its give permission issue so first of all run below command
sudo chmod 400 My.pem
After that try to connect with ssh command
and for file transfer use winSCP Tool.
you can check here for more detail
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html
Thanks
I'm running a google cloud instance. I'm able to successfully connect to the instance via ssh.
But I'm not able to do the port forwarding to my localhost.
Here's the command I used:
ssh -L 16006:127.0.0.1:8080 username#instance_external_ip
When I run the above command , I get the following error
The authenticity of the host cannot be determined.
username#instance_external_ip : Permission Denied (public key)
How to solve this problem?
I found the answer for this question. The problem I had was that the server did not know the ssh keys. So, I did the following and it worked.
I deleted all the ssh keys in the my local machine and connect to my gcloud instance using the following command. gcloud command creates the ssh keys automatically and it transfers to the cloud ssh keys automatically. So, no need to manually copy paste the keys.
gcloud compute --project "project_name" ssh --zone "zone_name" "instance_name"
After this I connected to my instance using ssh. Before doing if you try to ssh tunnel , as the server won't be aware of the localhost, it will say permission denied on running ssh -L .....
Therefore, instead of directly connecting through ssh -L ... , connect along with ssh-key file stored in .ssh directory. Use the following command.
ssh -i ~/.ssh/google_compute-engine -L <ur localhost port number>:127.0.0.1:<remote_host_port> username#server_ip
this is probably a simple stupidly question :)
I've created a new windows instance on Amazon EC2, and also downloaded the .pem file to SSH.
with cygwin
$ ssh -i mykey.pem Administrator#ec2-xx-xx-xx-xxx.us-west-2.compute.amazonaws.com
Administrator#ec2-xx-xx-xx-xxx.us-west-2.compute.amazonaws.com's password:
Permission denied, please try again.
permission set to 400 for mykey.pem file.
$ chmod 400 mykey.pem
I also tired with the putty by creating mykey.ppk file form mykey.pem with puttygen but getting access denied error :(
Using username "Administrator".
Authenticating with public key "imported-openssh-key"
Server refused public-key signature despite accepting key!
Administrator#ec2-xx-xx-xx-xxx.us-west-2.compute.amazonaws.com's password:
Access denied
dont know what kind of silly mistake im making here!
Please guys do u have any suggestion here?
Following are the most possible reasons-
Port 22 is not open while creating EC2 instance
Firewall configuration on your local machine(just try disconnecting VPN)
AWS account is suspended due to pending bill payment
SSH port on EC2 server were not open to incoming traffic.
I've an issue with capistrano when I want to deploy via remote_cache.
It's works fine on :copy.
I got this error :
[ssh.alwaysdata.com] executing command
** [ssh.alwaysdata.com :: err] Permission denied (publickey).
** [ssh.alwaysdata.com :: err] fatal: The remote end hung up unexpectedly
I've well set up my ssh key on my server and on my github & bitbucket accounts … so I don't understand why there is an publickey issue.
Here his the repo of my test project : https://bitbucket.org/valentincaen/deploy_-remote_cache
Thanks,
Valentin
I've resolved the issue, I had simply a passphrase on my ssh key. I generated a new key without passphrase and it's working