1

I'm trying to use google cloud to make my own SFTP server, the problem is I don't know how to properly use the ssh keys, everytime I try to connect with a ssh key the VM rejects it, any help?

I'm using PuTTYgen to generate keys and WinSCP to upload files on Windows clients, my VM is an Ubuntu server 14.04

Thank you all and sorry for my english.

1 Answers1

0

In order to be able to use OpenSSH, you need to copy your public key to your ubuntu's /home/<user name>/.ssh/authorized_keys file, enable pubkey authentication in your ssh server and afterwards you can use your private key with putty for login.

randomnickname
  • 513
  • 2
  • 11
  • My key is already in this file, (added by google) and the authentication is on but still i'm not able to connect to the server by sftp –  Dec 06 '16 at 14:14
  • What does the log say? – randomnickname Dec 06 '16 at 14:16
  • Dec 6 14:12:58 prueba sshd[23169]: Authentication refused: bad ownership or modes for directory /home/sftp/porton Dec 6 14:12:58 prueba sshd[23169]: error: Received disconnect from 190.251.68.42: 14: No supported authentication methods available [preauth] –  Dec 06 '16 at 14:18
  • I think I have the answer the home folder of this user was made using root, should I change the ownership? –  Dec 06 '16 at 14:19
  • Yes. Use `sudo chown -R : /home/sftp/porton/` to accomplish that. – randomnickname Dec 06 '16 at 14:22
  • Wow it work, can I call this mistake a begginer mistake?, **Thank you so much** –  Dec 06 '16 at 14:25
  • Call it learning ;) One advice for the future: always check permissions first! You don*t want to know how many errors are caused by this... I leared this the hard way ^^ – randomnickname Dec 06 '16 at 16:21
  • Would you mind to create a separate answer with this information and mark it as the solution? This way the question shows up as answered :) – randomnickname Dec 06 '16 at 17:26