Authenticate Subversion/Apache with Linux Accounts (Debian Squeeze)

1. Install packages

# aptitude install apache2 subversion libapache2-svn libapache2-mod-authnz-external pwauth
# a2enmod authnz_external

2. Make repository and change permission for Apache

# mkdir -p /srv/svn/ && cd /srv/svn/ && svnadmin create test
# chown www-data -R ./test && chgrp root -R ./test && chmod o-rx ./test

3. Update configuration files

Add the following lines to the end of /etc/apache2/apache2.conf

 AddExternalAuth pwauth /usr/sbin/pwauth
SetExternalAuthMethod pwauth pipe

Update /etc/apache2/mods-available/dav_svn.conf

<Location /svn>
DAV svn
SVNParentPath /srv/svn
AuthType Basic
AuthName "Subversion Repository"
AuthBasicProvider external
AuthExternal pwauth
Require valid-user
AuthzSVNAccessFile "/etc/apache2/svn_access"

4. Edit /etc/apache2/svn_access for permission

admin = your_admin1,your_admin2
guest = your_guest1,your_guest2
@admin = rw
@guest = r

Remember to replace "your_xxx" with your Linux accounts. 🙂

5. Access with Linux system accounts

svn co http://<server ip>:<server port>/svn/test/ ./test/

Of course, you can use any repo name to replace "test".



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s