question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to clone with SSH: unprotected private key file

See original GitHub issue

Describe the bug

When attempting to clone a git repository via the terminal, I get the error:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/etc/ssh/default-1569588924848/ssh-privatekey' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/etc/ssh/default-1569588924848/ssh-privatekey": bad permissions
Permission denied (publickey).
fatal: Could not read from remote repository.

I can’t change the permissions as Che is injecting this as readonly.

Che version

  • latest
  • nightly
  • other: please specify

Steps to reproduce

  1. Add SSH key with the SSH: generate key pair... command
  2. Restart workspace
  3. Launch terminal for main workspace container
  4. Run git clone {some git@ URL}

Expected behavior

SSH key should be mounted with appropriate permissions (i.e. 400 or 600).

Runtime

  • kubernetes (include output of kubectl version)
  • Openshift (include output of oc version)
  • minikube (include output of minikube version and kubectl version)
  • minishift (include output of minishift version and oc version)
  • docker-desktop + K8S (include output of docker version and kubectl version)
  • other: Rancher
kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.9", GitCommit:"3e4f6a92de5f259ef313ad876bb008897f6a98f0", GitTreeState:"clean", BuildDate:"2019-08-05T09:22:00Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6", GitCommit:"96fac5cd13a5dc064f7d9f4f23030a6aeface6cc", GitTreeState:"clean", BuildDate:"2019-08-19T11:05:16Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}

Installation method

Helm charts via Rancher

Environment

  • my computer
    • Windows
    • Linux
    • macOS
  • Cloud
    • Amazon
    • Azure
    • GCE
    • other (please specify)
  • other: please specify

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:41 (40 by maintainers)

github_iconTop GitHub Comments

1reaction
davidwindellcommented, Nov 8, 2019

@vinokurig it worked!! Great job, I am now able to clone via SSH.

0reactions
davidwindellcommented, Nov 21, 2019

@vinokurig thank you very much, I can confirm that setting FS__GROUP to NULL allows the SSH key to work 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting "Warning: unprotected private key file!" error message ...
It works. I have 10 servers, i copied the id_rsa from server1 to all other 9 servers then i got this error. To...
Read more >
Fixing UNPROTECTED PRIVATE KEY FILE.md - Github-Gist
If you are getting this error then you probably reset the permissions on your hidden .ssh directory in your user folder, and your...
Read more >
How to Fix SSH “Permission Denied” with Git Clone - Medium
First of all, ensure that your SSH key has been generated and the file containing the corresponding public key id_rsa.pub has been added...
Read more >
UNPROTECTED PRIVATE KEY FILE!” on Linux - How-To Geek
yes Failed to add the host to the list of known hosts (/home/geek/.ssh/known_hosts). This means that the permissions on that file are also...
Read more >
After adding a Bitbucket repository Fisheye is unable to clone it
It's caused by the fact that the private ssh key generated has file permissions which ... Repository cloning fails because the private key...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found