Shubham Verma
Shubham Verma

Reputation: 9963

How to get the remote access of server using SSH?

I am tring to remote access of my server terminal using SSH command. But I am facing error. I have created my ".ppk" file and trying to do as:

ssh -i MYFILE.ppk [email protected] -v -p 21098

I have entered the correct password, username, IP address and port. I am able to connect with putty but not using terminal/CMD. Please suggest.

I am getting this error:

OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to 198.187.29.149 [198.187.29.149] port 21098.
debug1: Connection established.
debug1: identity file MYFILE.ppk type -1
debug1: identity file MYFILE.ppk-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000002
debug1: Authenticating to 198.187.29.149:21098 as 'USER_NAME'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<8192<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:LQPAAsZ1vHcK//jXTbyUFWmqQ3FEEpKgb8FV6jbjoZE
debug1: Host '[198.187.29.149]:21098' is known and matches the RSA host key.
debug1: Found key in /Users/utkarsh/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: Will attempt key: MYFILE.ppk  explicit
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: MYFILE.ppk
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for 'MYFILE.ppk' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "MYFILE.ppk": bad permissions
debug1: Next authentication method: password
[email protected]'s password: 
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.```

Upvotes: 0

Views: 167

Answers (1)

Vipul Kumar
Vipul Kumar

Reputation: 479

The error you getting WARNING: UNPROTECTED PRIVATE KEY FILE! because private key file should be read-only file due to security reasons. Use the command chmod 400 MYFILE.ppk to assign 400 permission and then retry the same command it should work.

Moreover, the recommended approach to connect using ssh is to get .pem file (if you don't have .pem file convert your .ppk)

Please follow the below instructions to connect using ssh.

  1. convert you .ppk file into .pem
  2. change permission to read-only by using the command chmod 400 my_file.pem
  3. connect the remote server using command ssh -i MYFILE.ppk [email protected] -v -p 21098

Hope your doubt is resolved.

Upvotes: 1

Related Questions