| Ferrous Moon http://www.ferrousmoon.com:80/forums/ |
|
| Linux command question http://www.ferrousmoon.com:80/forums/viewtopic.php?f=55&t=1676 |
Page 1 of 1 |
| Author: | eddieringle [Tue Feb 17, 2009 8:33 pm ] |
| Post subject: | Linux command question |
Here's the deal, I am writing a script so that I can easily add pub keys for our git server. The problem is I need to add them as the git user. In the tutorial I ran through setting up gitosis it gave me: Code: sudo -H -u git gitosis-init < /tmp/id_rsa.pub
I need to be able to run that command using PHP's system function or exec function. I've figured that I don't necessarily have to run it as git, just as a user in the git group with the correct privs.However, I must be able to use git's home directory as gitosis-init requires it (hence the -H in the sudo command). So is there anyway www-data can execute gitosis-init while using git's home directory? (obviously giving www-data sudo access is a huge security threat) |
|
| Author: | ChaosR [Sun Mar 01, 2009 2:53 pm ] |
| Post subject: | Re: Linux command question |
Although it wont output to your current terminal (if you want this at all), it works: Code: sudo su -c "command"
The command can be any normal sh command, like:
Code: cd /root; touch him
|
|
| Author: | eddieringle [Sat Mar 07, 2009 11:46 pm ] |
| Post subject: | Re: Linux command question |
Quote: Although it wont output to your current terminal (if you want this at all), it works:
Unfortunately sudo does not work when a user does not have sudo privs (go figure). I gave up on this anyways, GitHub seems to be doing a darn good job themselves, so I'll let them deal with these sorts of problems. Code: sudo su -c "command"
The command can be any normal sh command, like:
Code: cd /root; touch him |
|
| Page 1 of 1 | All times are UTC-05:00 |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|