Setting up an SSH key for github - ssh-keys

I'm doing pre-courses for my classes that start soon and one of the tasks they'd like me to complete is setting up an SSH key for GitHub. Everything was going great, but upon copying the key to paste it into GitHub, the code "clip <> ~ / . SSH / id_ed25519.pub" I was instructed to enter didn't copy it, but said something like "...Is a directory". I'm not familiar with any of this as I'm just a beginner, so I started googling. I found the code "clip < ~/.ssh/id_rsa.pub" to copy, and tried that out. So it did copy the key and successfully link it in GitHub, but I then got to a point where the course was telling me to confirm it in the GitBash terminal. So I start to confirm it and the course tells me to confirm that the key fingerprint matches GitHub's public RSA key fingerprint. It did not match, but it did match the Ed25519 fingerprint. I connected anyways just to see if I could, and successfully connected. Any idea what I did wrong? Will this serve the same purpose, should it be fine? Thanks in advance.

Related

Need help finding SSH Token for Immersive Labs Going Places

I am trying to complete the Immersive Labs Going Places Lab. Using SCP I need to copy a file from a server to the host. I have no problem copying the file and opening it on the host machine. The question is "Copy the file ‘ssh_key’ from ‘alice’ back to localhost. What is the token you receive?" I have no idea what they are talking about when they say token. I have tried copying the contents of the file I copied but it isn't the write answer.
I bet it is something incredibly simple that I am just missing.
I am using the command scp alice#serverip:ssh_key targetfile.txt
As I said, I can copy the file no problem, but IDK what a token is!
As mentioned here, "token" can be used to reference the public key.
Since you have copied a private key, you can extract its public key with:
ssh-keygen -y -f targetfile.txt > ssh_key.pub
The below worked for me:
scp alice#serverip:ssh_key ssh_key

Bitbucket ssh key seems to "expire" after a few days

I have never had this issue before was hoping someone could help explain why this is happening, as I can't find anything online about it.
I was just given access to a new bitbucket project and account. When I first add my ssh key to my new account, I am able to clone things down easily everything works normally. For some reason though, after a few hours, I suddenly start getting Permission denied (public key) errors, and the only way i've found to solve it is to delete my previous ssh key and create a brand new one!
I am on a mac and I use ssh-keygen to create my key, and i always run ssh-add to add it to the agent. Then I delete the public key from bitbucket and create a new one with the new key's info, and it starts working again but only for a few hours!!
Is this a setting on the bitbucket i've been given access to? It doesn't seem to be as everyone I've spoken to that also has access does not have this issue. This has always been the way i've added ssh keys and I have no clue what I'm doing wrong.
Thanks!

SSH Public Keys not working against CloudBees Repositories

I'm trying to use git as my repository, and I keep getting the error: Permission denied (publickey).
I've tried generating keys on my computer and placing the generated key in my cloudbees account as well as my known_hosts file.
I've also tried adding the key listed in the Jenkins job that I created in my known_hosts, and I'm still unable to connect.
I'm not really sure how to obtain the correct key or how/where to go about placing the key in the correct places.
Any help would be much appreciated.
Thanks,
Danny
There are a couple of things to try shown at http://wiki.cloudbees.com/bin/view/DEV/Git+-+Getting+Started#HTroubleshooting
That being said, it sounds like you're new to SSH, and the commands in the above FAQ may not help.
Generally speaking you will generate a public and private key pair. The public key (~/.ssh/id_rsa.pub / ~/.ssh/id_dsa.pub) will be pasted into GrandCentral as shown in the link above.

github - asks for username and pass when it pushes/pulls

I have this issue, that I have to put this in every time I push or pull. I think this is new. Any ideas?
You are probably using the https url. Switch over to ssh and make sure your keys are setup fine ( and if you have empty pass phrase ) you should not have to enter the username and password.
Did you had this problem before? It most probably means you got something wrong in your public key setup. Make sure to not set a pass phrase while generating your public key. Also, make sure that you first try to login to GitHub using
ssh -T git#github.com
This should work without any passphrase. If it doesn't, check again the setup instructions for the operating system you are using.
Switch from https to ssh - instructions from GitHub's help docs are here.

Using expect to pass a password to ssh

How can I use expect to send a password to an ssh connection.
say the password was p#ssword
and the ssh command was
ssh me#127.0.0.1
What would I do with expect to a make it input the password when it says
me#127.0.0.1's password:
?
The proper action of using an SSH key pair isn't an option because I would have to use ssh (scp) to put the key on the server, which would ask for a password.
I always used the "proper" solution, but I used expect in other situations.
Here I found following suggestion:
#!/usr/local/bin/expect
spawn sftp -b cmdFile user#yourserver.com
expect "password:"
send "shhh!\n";
interact
Would it not be easier to use public key authentication and use a key with no passphrase?
As the user on the source machine do this to make an RSA key
ssh-keygen -t rsa
Now copy ~/.ssh/id_rsa.pub to the target machine and append it to the authorized_keys file of the target user
Your quickest way forward (unless you want to become a Tcl expert, which would be... unusual... in 2009) is probably to use autoexpect. Here's the man page:
http://expect.nist.gov/example/autoexpect.man.html
In short, fire up autoexpect, run your ssh session, finish up what you need to do, stop autoexpecting and then beat your keyboard over the resulting mess until it works :) I'm assuming you don't need anything more than a quick hack to get your keys sorted out and then, well it sounds like you know the score already with that.
And there's this question which already contains an example close to what you seek.
Cygwin has autoexpect just not in the bin package. run setup.exe and search for expect and check the source checkbox. you will see the resulting tree in /usr/src and in there there is a expect/expect/examples directory. in there lives a copy of the autoexpect script.
Key solution will not work... because the keys have to be readable only by the person running ssh. On xp you cannot create key structure with the correct permissions. So ssh will not read them. This may have changed, but last i checked it still not not work.
I'm pretty sure it is not possible to do what you're trying to do. Most *nix applications that prompt for a password read from the TTY directly, not stdin, so you can't pipe the password in. You can, as others have mentioned, configure SSH to not prompt for a password, as explained here.
After I was downvoted for no apparent reason, I went and did a little more research on the expect command and discovered that it has a send_tty command that sends to /dev/tty instead of stdin, which might actually do what you want... I was previously unaware of this feature. I still recommend putting the key on the server, however.