SVN:强制svn守护程序在不同的用户下运行 [英] SVN: Force svn daemon to run under different user
问题描述
我有一个小型NAS服务器(QNAP TS-210),有限的Linux板载。我有问题在我的本地SVN守护进程运行钩子。如果我直接运行它们,从命令行,一切都OK。如果SVN尝试运行它们作为钩子或者如果他们被添加到crontab然后CRON尝试运行它们都会失败。
我被告知这是由于运行这些脚本/钩子的用户之间的区别。我通过SSH作为admin登录到我的nas,并假设CRON和SVN都在root下运行。似乎root没有足够的目标文件夹的权限(我使用SVN post-commit-hook导出存储库到一些本地文件夹)或运行SVN / CRON(SVN也会失败在pre-revprop-change钩子,即使它只包含 exit 0
,所以我认为SVN根本不能运行钩子)。
EDIT :我的钩子脚本在< c $ c> / share / Sys / svn / tools_and_examples / hooks 所以,调用
ls - lh / share / Sys / svn / tools_and_examples / hooks
结果是:
-rwxrwx - x 1 trejder everyone 147 Jun 24 14:33 post-commit.cron *
-rw-rw ---- 1 admin admin 1.9k Jun 25 12:20 post-commit.tmpl
-rw-rw ---- 1 admin administrators 1.6k 6月25日12:20 post-lock.tmpl
-rw-rw- --- 1 admin administr 2.2k Jun 25 12:20 post-revprop-change.tmpl
-rw-rw ---- 1 admin administr 1.5k Jun 25 12:20 post-unlock.tmpl
-rw-rw ---- 1 admin administrators 3.3k 6月25日12:20 pre-commit.tmpl
-rw-rw ---- 1 admin administr 2.4k Jun 25 12:20 pre-lock。 tmpl
-rw-rw ---- 1 admin administr 6 Jun 25 12:29 pre-revprop-change
-rw-rw ---- 1 admin administr 2.1k Jun 25 12:20 pre -unlock.tmpl
-rw-rw ---- 1 admin administr 2.7k Jun 25 12:20 start-commit.tmpl
和 ls -lh /share/Sys/svn/tools_and_examples/hooks/post-commit.cron
给我这个:
-rwxrwx - x 1 trejder everyone 147 Jun 24 14:33 / share / Sys / svn / tools_and_examples / hooks / post-commit。希望,这将有所帮助。
< / etc / crontab
您应该使用
crontab -e
以管理员身份登入,想由管理员用自己的crontab启动。如果我没有错,它应该启动它作为管理用户
I have a small NAS server (QNAP TS-210) with a limited Linux on-board. I have problems running hooks in my local SVN daemon. If I run them directly, from command-line, all is OK. If SVN try to run them as hook or if they're added to crontab and then CRON tries to run them, both fails.
I was told that this is due to difference between users running these scripts / hooks. I'm logging to my nas via SSH as "admin" and assume that both CRON and SVN are run under "root". Seems that root hasn't got enough privileges for destination folder (I use SVN post-commit-hook to export repository to some local folder) or to run SVN / CRON (SVN also fails on pre-revprop-change hook, even if it contains only exit 0
, so I assume that SVN can't run hooks at all). Or maybe this is something different?
EDIT: How can force SVN to run under "admin" or how can I set enough privileges for "root", so it can run SVN hooks just as I can ("admin")?
EDIT: My hook script is in /share/Sys/svn/tools_and_examples/hooks
so, calling
ls -lh /share/Sys/svn/tools_and_examples/hooks
results this:
-rwxrwx--x 1 trejder everyone 147 Jun 24 14:33 post-commit.cron*
-rw-rw---- 1 admin administ 1.9k Jun 25 12:20 post-commit.tmpl
-rw-rw---- 1 admin administ 1.6k Jun 25 12:20 post-lock.tmpl
-rw-rw---- 1 admin administ 2.2k Jun 25 12:20 post-revprop-change.tmpl
-rw-rw---- 1 admin administ 1.5k Jun 25 12:20 post-unlock.tmpl
-rw-rw---- 1 admin administ 3.3k Jun 25 12:20 pre-commit.tmpl
-rw-rw---- 1 admin administ 2.4k Jun 25 12:20 pre-lock.tmpl
-rw-rw---- 1 admin administ 6 Jun 25 12:29 pre-revprop-change
-rw-rw---- 1 admin administ 2.1k Jun 25 12:20 pre-unlock.tmpl
-rw-rw---- 1 admin administ 2.7k Jun 25 12:20 start-commit.tmpl
and ls -lh /share/Sys/svn/tools_and_examples/hooks/post-commit.cron
gaves me this:
-rwxrwx--x 1 trejder everyone 147 Jun 24 14:33 /share/Sys/svn/tools_and_examples/hooks/post-commit.cron*
Hope, this will help.
解决方案 for a cron being launched as admin, instead of editing
/etc/crontab
you should use
crontab -e
logged in as admin and put whatever command/script you want to be launched by admin with its own crontab. If I'm not wrong, it should launch it as the "admin" user
这篇关于SVN:强制svn守护程序在不同的用户下运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文