gogs: Incorrect permission of .ssh/
Hi there,
Got Gogs working on an Amazon EC2 instance, and love it. HTTP pushing and pulling works, no problem, but SSH doesn’t appear to.
The users on the instance are root
, ec2-user
, and git
. git
is the user that is running Gogs, and has the correct permissions for everything.
For my Gogs user josh
, I’ve added an SSH key. It is in the /home/git/.ssh/authorized_keys
file, I have confirmed that (and can post it if required). However, when the git@git.example.com:/josh/example
protocol is used, it won’t work even though the key has been added.
It fails with the error in the title.
I’m guessing it’s an SSH configuration error, or something similar? What am I missing? I can provide more info if required.
Cheers Josh
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 42 (23 by maintainers)
Commits related to this issue
- Work #475 and #458 — committed to gogs/gogs by unknwon 10 years ago
Hello people,
here the same messages… i resolve change the permission of .ssh folder sudo chmod -R 600 .ssh the message don’t show anymore, i hope this help somebody, best regards
Ah, I see what the problem was.
The new
git
user had no~/.ssh
folder when it was created, but Gogs made one. Gogs also created theauthorized_keys
file, but somehow it got the permissions or ownership wrong (possibly because of me! I think I may have stuffed it up along the way) – so resetting the ownership and permissions of~/.ssh/
, deleting the keys andauthorized_keys
file, and creating it again by hand with one regular SSH key and the correct permissions has fixed it 😃Might want to take a look at that use case though; to replicate, create a brand new user with no
~/.ssh/
folder, and start up Gogs under that user. Add some keys, and you’ll run into the same problem 😃