heroku complaining about my public key created by ssh-keygen2 - heroku

I am trying to access my heroku app from work (windows machine).
I installed cygwin on the machine and generated ssh-key as well. However, I get the below error:
C:>heroku keys:add
"C:\cygwin\home\4541450\mycoolemail#email.com"
Uploading ssh public key
C:\cygwin\home\4541450\mycoolemail#email.com
Enter your Heroku credentials. Email:
mycoolemail#email.com Password:
Uploading ssh public key
C:\cygwin\home\c54550\mycoolemail#email.com
! Contents Invalid public key /
Contents Invalid public key /
Fingerprint can 't be blank
I generated the ssh key with the command below.
ssh-keygen2 "mycoolemail#email.com" -t
rsa
ssh-keygen is not available with this cygwin.

the "C:\cygwin\home\4541450\mycoolemail#email.com" should be your public key, not the private one

Perhaps my other answer here is helpful. It's my setup for deploying to Heroku from Windows.

Do you have a passphrase on the key? Mine didn't work until I generated one with a passphrase.

Related

Spring Cloud Config using Bitbucket - SSH keys

I'm facing an error when I try to authenticate in Bitbucket using SSH private key to get my application.properties.
org.eclipse.jgit.api.errors.TransportException: https://companyuser#bitbucket.org/repositorios/cup-configuration-files: not authorized
Steps:
1) I've generated the key pair using ssh-keygen with a password
~/Development/ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ainacio/.ssh/id_rsa):
2) I've copied the key.pub to Bitbucket
Bitbucket - User - Personal Settings - Add key
3) I've configured in bootstrap.properties the private key
spring.cloud.config.server.git.uri=https://companyuser#bitbucket.org/repositorios/cup-configuration-files
spring.cloud.config.server.git.ignoreLocalSshSettings=true
spring.cloud.config.server.git.passphrase=password
spring.cloud.config.server.git.privateKey=-----BEGIN OPENSSH PRIVATE KEY-----\n
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABD4Kfq1XF
NpUPV+q/U7OPwhAAAAEAAAAAEAAAGXAAAAB3NzaC1yc2EAAAADAQABAAABgQDuPOdeTNts
gLWlN7hLM7h+R9W76HjzrJ6pNHFVq8htKaQodmGuNFrna1y6k88FMds4XAJIv8rB2C2TyD
Y+eVKsKCfQ7xSoP/3NwOegRmvVYVUETvDJrop2Cmi4DnM6QlrtDum+VicEKjtQD7sOJ85R
WJpHkf/+CIZW8cbwdaMAjtr9LE6t+4lOg15Xfyu9zFI4YBpxb3C08/x4CS0bdiWX73Z+uT
AQWfGSbcxXleFHCDv0xCvE6/uMt2rTsnuFfLNTannEwzIYLV//0eMesQywzN+D3gxPZKeG
P1E54xXVjewsW74GJhmnI5Tm5DvsXvvQ5bkELH+isPrH9sZbncPFq9e6qjA88gk2BCLEe/
E5jdL0OKrIGFJjwpN8T/sDfq3SvuLIPvOsLlZXw0yUDgTvJdLKdwSFFB7WPKZqINXBSmKr
PUKZMm3WBB4gLccU+vD/1uardrMZ5lj0hJp7YRukWfXCFvZYLs0lnM2xnTuFsKNOfxOKDv
....
What is missing? I tried to find some tutorials but I couldn't.
PS: I'm in development environment. Accptance and production I'll use the file on .ssh server directory.
It needs to use RSA encryption algorithm ssh-keygen -m PEM -t rsa -b 4096 -C 'bitbucket_username'

Authentication by key in Ruby via ssh: Could not parse PKey: no start line

I'm trying to connect to a server with ssh using an ssh key. The logs me an error and it also asks me for the password which I shouldn't be asked for because I'm using the key authen-ion and my intention is get rid of having to enter the password:
ERROR -- net.ssh.authentication.key_manager[2b02154b7610]: could not load private key file `/home/me/.ssh/id_rsa.pub': ArgumentError (Could not parse PKey: no start line)
My code:
Net::SSH.start(ip_item, "root", host_key: "ssh-rsa", keys: ["~/.ssh/id_rsa.pub"], verbose: :debug) do |ssh|
Is that a bug? Why does it say "private"?
The key exists.
I'm able to connect to the server via the terminal without a password and it's added to the list of the known hosts of the server properly since I'm able to connect to it.
Also cat ~/.ssh/authorized_keys on the server shows my public key.
You need to provide the path to the private key when connecting to a host, not the public key.
Try change "~/.ssh/id_rsa.pub" to "~/.ssh/id_rsa" in your code. It should help.

OpenSSH for Windows connection with private key and passphrase

I want to switch from Putty to OpenSSH for SSH connections in windows to our servers. I want to use OpenSSH only as client and I have a private key with additional passphrase.
I tried to connect to my server and OpenSSH loads the keyfile, but everytime I enter the passphrase, it seems that it isn't correct.
C:\Users\user>ssh -i D:\folder\.ssh\private_key user#host
Enter passphrase for key 'D:\folder\.ssh\private_key':
Enter passphrase for key 'D:\folder\.ssh\private_key':
Enter passphrase for key 'D:\folder\.ssh\private_key':
user#host's password:
You can see, my keyfiles are not located in the standard folder. I don't think that this is the problem, so only fyi.
What is the problem? I installed OpenSSH with the standard configuration and changed nothing.
Edit:
I also tried a different keyfile on an other server which has also a passphrase: this also doesn't work. Is that maybe a problem in configuration?
I'm sorry.
I discovered that I load a very old version. I think I get it from sourceforge and the executables are very outdated (year 2003 to 2004).
You can get a actual version from github: https://github.com/PowerShell/Win32-OpenSSH/releases/. I don't know if this is the official release. It's a bit confusing.

Public key issue with command line in sourceTree (git )

I usually use git on linux and I'm not familiar with sourceTree on windows ( c# project ), the interface is usefull to follow the tree, but I would like to the use commande line .
I really don't understand, I generated my ssh key with sourceTree agent and load with "Pageant", I added the public key on my bitbucket account.
And it works. I can clone/pull/push from the sourceTree interface
But using the sourceTree command line mode doesn't work
Set SSH Key to a PuTTY private key (.ppk) and set SSH Client to PuTTY / Plink
Set an environment variable GIT_SSH to the path of plink.exe, for example C:\Program Files (x86)\Atlassian\SourceTree\tools\putty\plink.exe
Of course you could have a separate, global OpenSSH key in %HOMEPATH%\.ssh\id_rsa but then you would lose the advantage of SourceTree loading the correct key automatically.
By the way, I can confirm that neither of these work:
Setting SSH Key to an OpenSSH private key and using OpenSSH as SSH Client
Setting SSH Key to a PuTTY private key and using PuTTY / Plink as SSH Client
Nothing of the above was necessary to make it work for me. The only necessary aspect to consider is that by default git (and maybe other apps) expect your ssh key in c:/users/<user>/.ssh. Mind the dot! After I renamed my ssh folder to .ssh all started working fine.
you need to generate public key from console.
like this
ssh-keygen
it will generate public key that you can add it in Bitbucket
for more info visit this Tutorial

SHA Key with Windows and MsysGit/Free CopSSH

OS (for better or worse) is XP
I am having some issues, I have seen other questions but none seem to apply to me.
I have CopSSH installed and I can log in using cleartext password.
Now I want to upgrade that to SHA keys.
I use PuttyGen to get a public and private key
I then copy those into ~/.ssh and %ICW%/home/%un%/.ssh as id_rsa and id_rsa.pub.
I add the public key as follows....
Example Pubkey
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20121115"
AAAAB3NzaC1yc2EAAAABJQAAAIBdfRGHY4IYsUuDYzbgEy1wKXrszq5RVR4m2/gP
WJwLwiaNHpahfPeHmsG7nD7qeVNVp+sSVouApm70ZdfGnxzOHiBydtdOuco+sbqZ
irlyG9wS5yv8x9LFsGqZ34tbr8dgPXMdYnrJHJqUa3+ZMUNPXznRUzj/VTiwoS6/
jMHzkw==
---- END SSH2 PUBLIC KEY ----
Example known_host
<ServerName>,<IP>,localhost ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIBdfRGHY4IYsUuDYzbgEy1wKXrszq5RVR4m2/gPWJwLwiaNHpahfPeHmsG7nD7qeVNVp+sSVouApm70ZdfGnxzOHiBydtdOuco+sbqZirlyG9wS5yv8x9LFsGqZ34tbr8dgPXMdYnrJHJqUa3+ZMUNPXznRUzj/VTiwoS6/jMHzkw== UN#SERVER
So now I add the generated private key to putty and try to connect but I see the following...
Server refused our key
It still allows me to log in using my password.
How can I get the Private Key auth to work?
Check if Itefix FAQ https://www.itefix.no/i2/content/i-want-use-my-own-pka-key-pair-instead-one-generated-copssh can be helpful.

Resources