trejder
trejder

Reputation: 17505

SVN: Force svn daemon to run under different user

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.

Upvotes: 0

Views: 525

Answers (1)

Dolanor
Dolanor

Reputation: 820

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

Upvotes: 1

Related Questions