I need to SSH on to my Linux box from Jenkins using AWS cli. To do so, AWS documentation states I need to use my pem key:
ssh -i /path/my-key-pair.pem ec2-user#ec2-198-51-100-1.compute-1.amazonaws.com
However, Jenkins does not have access to where I have the pem file stored and moving it is not an option.
I have generated a sshagent in Jenkins using my pem file, but cannot find any documentation or examples that show how replacing the path to pem file with my sshagent would work.
Does anyone have any any idea what the syntax is or could be point me in the direction of some documentation on this?
You have mixed two questions or things:
to ssh you certainly need the .pem key but not to execute the aws cli. Use below for ssh from jenkins to ec2 instance.
Instead of doing the above you can update the EC2 instance ec2-user /home/ec2-user/.ssh/authorized_keys with the public key of the jenkins user.
For executing aws cli commands if you want you need to use Access Credentials.
Related
I am trying to use SSH plugins in Jenkins to execute the script on the remote host server. I have added the remote user credentials on Jenkins but not able to make the connection on AWS ec2 instance.
screenshot of the error:
Am I missing any steps while doing the configurations? How can I resolve this issue?
Some things to consider
Does the Security Group on the Target 3.56.98.1 allow for SSH
access from the Jenkins IP address?
Do you have the Public SSH Key of Jenkins added to the targets authorised keys file?
Have you set the correct username that Jenkins will use in the target ubuntu, ec2-user, other?
I followed this link https://docs.gitlab.com/ee/ci/ssh_keys/README.html#ssh-keys-when-using-the-shell-executor to install SSH key using shell executor.
all the steps were running fine but at the final step when I tried to log in to the remote server in order to accept the fingerprint
by this script ssh gitlab-runner#myserver.com
I receive the following error
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
I added the ssh public key in settings >> sshkey
also add it into variables as SSH_KNOWN_HOSTS
I couldnt find what is the issue , could you help me , thanks
Try a ssh -Tv gitlab-runner#myserver.com in order to check which exact key and paths are considered when trying to read the remote server.
That will give you a clue why the connection fails, when you compare those paths with the ones set up when you inject an SSH key into your build environment by extending your .gitlab-ci.yml.
I'm currently using a sandbox environment to help gain an understanding of Linux and Ansible.
I have a rhel 7.6 VM where Ansible is installed/ran from that i connect to via moba. I then have 2 test VMs that i'd like to run Ansible against.
I cannot SSH from the Ansible VM to either of the test VM's (Permission denied public key) but i can connect directly to the test VM's.
How do i set up the keys/hosts? does the private key need to be uploaded to the Ansible VM?
Try to deploy ~/.ssh/id_rsa.pub key from Ansible control machine to one of your VM's in a file ~/.ssh/authorized_keys. Copy the contents of ~/.ssh/id_rsa.pub from the Ansible control machine in ~/.ssh/authorized_keys on the target host. You may use the ssh-copy-id command to perform this for you so long as you have access to the target host via some method.
another method different from best practice id_rsa.pub deployment is configuring inventory vars for your hosts/groups by setting ansible_user, ansible_ssh_pass (with vault usage), ansible_become_user, ansible_become_pass (with vault usage)
I'm trying to add codeship SSH to aws cat ssh-rsa [SSH_KEY] >> .ssh/authorized_keys but I've encountered following error cat: ssh-rsa: No such file or directory regarding http://www.eq8.eu/blogs/19-setting-up-simple-wordpress-deployment-with-codeship-to-aws-ec2
Please let me know how to solve it. Because I'm now trying to deploy nodejs application to aws with codeship. Or is there anyway I can deploy nodejs application to aws with codeship.
You can find the public key for your Codeship project on the projects General settings page. You can then take this key and add it to the .ssh/authorized_keys file on the EC2 instance(s) you want to deploy to.
See https://documentation.codeship.com/general/projects/project-ssh-key/ for the documentation article on this topic.
I used to connect to Amazon web services using ssh command and application.pem key. Now when I try to connect to other platforms such as Github my ssh client looks for same application.pem key and tries to connect to AWS. How do I connect to Github or change the default host and key configuration.I am using a Ubuntu 13.10 system and following is my ssh output.
pranav#pranav-SVF15318SNW:~/.ssh$ ssh
Warning: Identity file application.pem not accessible: No such file or directory.
You need the identity file to login to the box. Use the command:
ssh -i (identity_file) username#hostname"
This worked for me. Write just the filename (without any slashes), unlike Amazon EC2 tutorial which asks you to enter:
ssh -i /path/key_pair.pem ec2-user#public_dns_name
and also check the permission