Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload-key permission denied #5

Closed
sijk opened this issue Jun 26, 2013 · 4 comments
Closed

upload-key permission denied #5

sijk opened this issue Jun 26, 2013 · 4 comments

Comments

@sijk
Copy link

sijk commented Jun 26, 2013

I really like the idea of having repos created when pushed to -- nice work!

One thing that's hanging me up, though, is when I try to upload a key. The git user's authorized_keys file is writable only by git, as I understand is required by ssh. Therefore when I run

cat ~/.ssh/id_rsa.pub | sijk@server 'gitreceive upload-key sijk'

I get a permission denied error. From my understanding of ssh etc. I don't see how it could possibly work, but presumably it works for you...?

@ghost
Copy link

ghost commented Jun 26, 2013

You'd have to run sudo first: cat ~/.ssh/id_rsa.pub | ssh sijk@server 'sudo gitreceive upload-key sijk'

I've created a PR to notate this in the README.

@sijk
Copy link
Author

sijk commented Jun 26, 2013

Hmm, I suspected as much. I'm trying to figure out how to let unprivileged users (non-sudoers) upload their own keys. Current musings:

  • Give the git user a trivial password
  • Set up (a modified version of) gitreceive as a kind of restricted shell
  • Upload via cat ... | ssh git:git@server 'upload-key sijk'
  • Somehow limit push/pull access to those authenticated via publickey so that you can't push using the trivial password.

I don't know if all that's possible, but I'll experiment with it when I get the time.

@sijk sijk closed this as completed Jun 26, 2013
@progrium
Copy link
Owner

Giving git user a trivial password will probably kill the experience of pushing with git. I'm not sure what you mean by making it a restrictive shell or how that would help.

It's all just a permissions issue. You can create a non-root, non-git user that has access to write to the git user's authorized_keys file and give that user a trivial password. Or you can wrap some kind of automation (a web server maybe) around it that runs as a user with permission.

This is why I was hesitant about your pull request -- you don't need to be root to use gitreceive upload-key and now it implies you do.

@ghost
Copy link

ghost commented Jun 26, 2013

Hmm - true. Perhaps a note before we start diving into examples is needed. Something along the lines of "in this document sudo is used to escalate privileges as needed, but you may run the commands from any user that has access to ~git/.ssh/authorized_keys." I'll let you refine & place it somewhere that makes sense.

(On a side note: I didn't create this issue, just submitted a PR - you seemed to reference me when replying to @sijk)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants