After I added following lines to the /etc/ssh/sshd_config for sftp setup as online guide suggested.

Match group sftp
ChrootDirectory /home
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

I can not open ssh to instance with "This service allows sftp connections only" message.
I guess ForceCommand internal-sftp limits ssh connection.
It's dummy that I blocked myself.. Is there way to fix this problem without lossing instance data? Any help will be highly appreciated. (Pics are captured from my gcp-cloudshell)

enter image description here enter image description here

  • 1
    Login with a different user, that is not in the sftp group. – Michael Hampton Dec 6 '18 at 17:25
  • If Michael's suggestion does not work, this SO answer will help you save the data. stackoverflow.com/a/53700151/8016720 – John Hanley Dec 10 '18 at 8:29
  • @JohnHanley Thank you for suggestion! I downloaded important files and moved it to new instance by sftp manually. I hope other user with similar problem would find some help from your link, thanks again. – sngjuk Dec 10 '18 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.