Closed incorvia closed 12 years ago
This problem is a problem with your sudoers file. The "no tty present" issue is a red-herring. For some reason, your webserver is unable to sudo to your "git" user. Didn't you say that the webserver was "www-data" in an earlier post?
I'm using thin webserver.. the errors I showed are when I run it in detached mode.. when I run thin in standard mode it asked for a sudo password on launch and now it says the web user can sudo to the git user but not vice-versa and the hook was now installed fine. The log shows this with:
Processing SettingsController#plugin (for 71.184.181.23 at 2012-01-24 16:34:22) [GET] Parameters: {"action"=>"plugin", "id"=>"redmine_git_hosting", "controller"=>"settings"} Rendering template within layouts/admin Rendering settings/plugin Our hook is already installed Testing if git user("git") can sudo to web user("kevin") Error while testing sudo_git_to_web_user: Testing if web user("kevin") can sudo to git user("git") Completed in 654ms (View: 652, DB: 0) | 200 OK [http://hq.jamfoundry.com/settings/plugin/redmine_git_hosting]
So thin must be running in detached mode as a different user then it does in non-detached mode.. When I start it detached the pid shows:
kevin 17540 93.0 4.9 233980 104128 ? R 16:41 0:05 thin server (0.0.0.0:3000)
So I guess I've been thinking that Kevin was the correct one... I can try adding www-data instead of 'kevin' in the sudoers and see if that afixes it.
I changed my sudoers so it reads:
# User privilege specification root ALL=(ALL) ALL www-data ALL=(git) NOPASSWD:ALL git ALL=(www-data) NOPASSWD:ALL kevin ALL=(git) NOPASSWD:ALL git ALL=(kevin) NOPASSWD:ALL kevin ALL=(www-data) NOPASSWD:ALL # Allow members of group sudo to execute any command # (Note that later entries override this, so you might need to move # it further down) %sudo ALL=(ALL) ALL %admin ALL=(ALL) ALL # #includedir /etc/sudoers.d Defaults:www-data !requiretty Defaults:git !requiretty Defaults:kevin !requiretty
I shut down the server... logged out.. logged back in.. checked git permissions:
git@foundry:/home/kevin/redmine$ sudo -l Matching Defaults entries for git on this host: env_reset, !requiretty User git may run the following commands on this host: (www-data) NOPASSWD: ALL (kevin) NOPASSWD: ALL (ALL) ALL
seems good.. booted up the server.. and same error.. hmm
One thing I've noticed people saying is that if you add '-t' to the ssh command it 'might' fix this.. for instance:
http://pho3nixf1re.net/blog/deploying-nesta-with-vlad
Maybe I could try that?
Well.. this is really bizarre.. I moved the group permissions in the sudo file above the user permissions and it all works now... I figured I should test if it would break if I moved it back below.. but no.. it still works.. so now it works.. and i've tried tons of configurations to make it 'not work' and nothing is making it not work.. for similar issues online it seemed that most people said 'it just started working' when they did get it to work.. so IDK.. i'm going to close this issue.. I can reopen it if the error comes back :-|
Ok. I love bugs that require no work on my part.
Let me know.
:-) Actually it does seem related to the order of things in my Suoders file.. cause it just turned off again.. so I switched it back and it fixed it.. putting the group permissions above the user permissions seems to fix it for me.. it's worth nothing because I see very few fixes for this TTY problem online and if anyone comes here with a similar issue.. it's at least worth a try:
# Allow members of group sudo to execute any command # (Note that later entries override this, so you might need to move # it further down) %sudo ALL=(ALL) ALL %admin ALL=(ALL) ALL # #includedir /etc/sudoers.d # User privilege specification root ALL=(ALL) ALL kevin ALL=(git) NOPASSWD:ALL git ALL=(kevin) NOPASSWD:ALL Defaults:git !requiretty Defaults:kevin !requiretty
Hey everyone, just letting you know this solution also worked for me if anyone else has this problem.
@jimmyblanchard glad to hear it.
Are you using the new master branch here? (i.e. version 0.5.0x of the plugin)? If so, which version of Redmine and/or Chiliproject are you using?
Thanks! It works for me ALSO!!!(I'm using chili)
Thanks for this. I had a closer look at the manual page for sudoers (on Centos 6), and right near the top, in the second paragraph, I found the following (which I''ve known before)
When multiple entries match for a user, they are applied in order. Where there are multiple matches, the last match is used (which is not necessarily the most specific match).
I imagine this probably comes as a surprise to most people using sudo.
Though not related to this repo, but the reordering the group above the user did fixed mine issue to on Ubuntu 11.10
# Sudoers file for Ubuntu
ubuntu@milli:~$ sudo cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
%admin ALL=(ALL) ALL
%sudo ALL=(ALL:ALL) ALL
# User privilege specification
root ALL=(ALL:ALL) ALL
ubuntu ALL=(ALL:ALL) NOPASSWD:ALL
#includedir /etc/sudoers.d
This seems to be a persistent problem.. it says my hook isn't installed.. I can't figure out how to fix it....
I did upgrade sudo and that didn't seem to fix this issue at all.. in my sudoers file I have:
I've also restarted my webserver, the reverse proxy server (nginx), and rebooted the server itself... I have no idea how to begin to diagnose this problem and google doesn't seem to have any ideas either... thoughts :)