Cant connect to my VPS from Ubuntu Terminal

January 28, 2016 544 views
Linux Basics Getting Started Ubuntu

im try connect to my server using ubuntu terminal

ssh -p 2222 -i mypublickey.ppk username@ip

then its ask
"Enter passphrase for key 'mypublickey.ppk':"

Im entering my password but its always wrong then i got error
Permission denide (publickey).

i have no problem if connect from Putty ubuntu or windows

1 comment
  • @kabargamesdotid - To be clear, your ssh session that fails is on the same Ubuntu machine as your PuTTY session which works. Is that correct?

    Are you being asked for the passphrase when using PuTTY? If not being asked for the passphrase using PuTTY, is your private key file in PuTTY the same file as ./mypublickey.ppk when you use ssh? (Note: ssh usually uses a '.pub' file and not '.ppk' file)

2 Answers

From the error message, it sounds like you have a key pair associated with the account you are trying to log in to and the Ubuntu machine you are on. The private key is encrypted with a passphrase, so before it can be used to sign you in, you need to provide the passphrase to decrypt it. This passphrase is different from the password on the server that you are using when logging in with PuTTY.

To force a password-based login, use:
ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no

If you don't remember the passphrase, you'll need to remove the idrsa and or iddsa and files from your ~/.ssh directory on the local machine and/or remove the associated key from the .ssh/authorized_keys file on the server. Once you do that, you'll default to password-based login.
I need to convert the PPK key to openssh format.
sudo apt-get install putty-tools
puttygen mypublickey.ppk -O private-openssh -o mypublickey

then connect

Have another answer? Share your knowledge.