I needed to clone a repo from Gitea and I normally do it on my Mac but I don't have my Mac with me. I was able to clone the repo on Windows after placing the RSA key in the .ssh folder that's in C\Users\me while using Git Bash for Windows, but I could not do it with WSL. I then tried copying the files in the C\Users\me.ssh and placing them in the Linux file system's .ssh folder. Did not work. I tried deleting WSL .ssh folder and making it a symlink to the C\Users\me.ssh one, and still didn't work. How can I fix this?
Asked
Active
Viewed 1,018 times
1 Answers
3
I suppose it is permissions issue. The SSH keys are private data. In Ubuntu/Linux they must have restrictive permissions, so only the owner user can read them. You can set the proper permission by the following commands:
sudo chown -R "$USER:$USER" ~/.ssh # make sure the files are owned by the user
find ~/.ssh -type d -exec chmod 700 {} \; # set drwx------ permissions for the dirs
find ~/.ssh -type f -exec chmod 600 {} \; # set -rw------- permissions for the files
- note,
~/represents the user's$HOMEdirectory, i.e./home/<user>/.
Another possible trouble maker is the way you've created the files. In Windows, lines end with both the line feed and carriage return ASCII characters, but Unix uses only a line feed. In such case you can process the ssh key files by dos2unix or you can use some of the other approaches, shown here.
See also:
pa4080
- 30,621