Reputation: 2092
I can authenticate successfully with putty
on the server with my private key
and passphrase. But when I try to do it with jenkins publish over SSH plugin (using Test for configuration), I get the following error message:
jenkins.plugins.publish_over.BapPublisherException: Failed to connect session for config myconfig. Message [Auth fail]
I entered the same information as in putty:
Hostname : myhostname
Username : myusername
Remote Directory :
Use password authentication, or use a different key Passphrase / Password
Path to key : checked
Path to key : mypath
Passphrase : mypasssword
Key:
Port:22
Timeout(ms):300000
If you have any idea ... Thanks for your help.
Upvotes: 10
Views: 82151
Reputation: 97
I have the same problem,I am on windows, the solution:
userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
PubkeyAcceptedKeyTypes=+ssh-rsa
in server sshd_config
file, detail clickFailed to connect SFTP channel
and debug is
debug1: subsystem: cannot stat sftp-server.exe: No such file or directory
this because the openssh no in windows system path. detail clickUpvotes: 0
Reputation: 1
If you use RSA key, and see string like this in your private key:
-----BEGIN RSA PRIVATE KEY-----
***************************************
-----END RSA PRIVATE KEY-----
You need edit config file sshd on remote machine:
sudo vim /etc/ssh/sshd_config
add in this file stoke:
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
Upvotes: 0
Reputation: 4945
I was having the same exact issue today and thought I would share what worked for me
Normally when I would SSH into my ec2 instance AWS likes the username to be
ubuntu@[ip address/url]
Jenkins likes it to be just the username so remove the rest
ubuntu
Upvotes: 0
Reputation: 464
Just copy jenkins-user's id_rsa.pub to the end of ~/.ssh/authorized_keys on remote host.
Upvotes: 0
Reputation: 65
Sometimes the SSH connection would fail, if the destination server doesnt have enough disk space to perform PUT operation
{ERROR: Exception when publishing, exception message [Failure]}
Make sure to verify the destination server has enough disk space.
In case of Linux, you can use 'df -kh /directoryname' to check the disk space
Upvotes: 0
Reputation: 1
Don't do any ssh-keygen. Just enter the pem key details under key field, Add SSH server details: Name, Hostname and Username as ec2-user. Click test connection and it works.
Upvotes: 0
Reputation: 1148
Try restarting ssh of remote server
/etc/init.d/sshd restart
Upvotes: 0
Reputation: 31
Because your linux login need password, the answer is :
1. Passphrase: your passphrase
2. path to key: your private key path
3. key : blank
4. Disable exec : un-check
SSH Servers
1. Name: [email protected]
2. hostname: remotehost.com
3. Username: remote_user
4. Remote Directory: empty
Advanced --
5. check the box "use passsword authentication, or use a different key"
`important`
6. Passphrase / Password: your linux login password`important`
7. path to key: blank
8. key:blank
9. port: 22
10. Timeout(ms): 300000
'Test Configuration' success
Upvotes: 3
Reputation: 10001
Looks like you're using keyfile authentication, so you'll get this error from Jenkins if you haven't set the permissions correctly on your .ssh
folder and/or ~/.ssh/authorized_keys
file.
.ssh
folder should have drwx------
permissions (read/write/execute owner only)authorized_keys
file should have -rw-------
permissions (read/write owner only)To fix it:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Upvotes: 20
Reputation: 326
I ran into the same issue today and it turned out i was accidentally supplying the path to the public key instead of the private one.
So the "path to key" should be something like
.ssh/id_rsa
instead of
.ssh/id_rsa.pub
Upvotes: 6
Reputation: 21
I am facing same issue , the following steps work for me:- ( i am using jenkins 1.57)
success
Upvotes: 1
Reputation: 489
Check that the public key is in the .ssh/authorized_keys
file on the target server, even if the target server is the same as the jenkins server. I had what is probably the same problem, and it turned out that I needed this, even though ssh localhost
worked fine.
(Addendum: also check that the jenkins server has the target server in its .ssh/known_hosts
file, as that can affect this as well.)
Upvotes: 2
Reputation: 2460
I think as it says this is a authentication issue:
Use password authentication, or use a different key Selecting this option will produce 3 more configuration boxes that mirror the options available for the Jenkins SSH Key.
Passphrase / Password If either Path to key or Key are configured then this is the passphrase to use with the encrypted key. If no key is configured then this is the password that will be used for password authentication.
Path to key See description above.
Key See description above.
Disable exec This option will remove the ability to execute commands using this configuration.
Upvotes: 1