본문 바로가기
Linux

SVN 권한 설정 ubuntu 22.04 (apache mod dav svn)

by IT너구리실장 2023. 12. 1.
반응형


 

SVN 서버 만들기 - Ubuntu 22.04

Subversion 은 일반적으로 SVN 으로 불립니다. 소프트웨어 개발 프로젝트에서 버전 관리 시스템(VCS)으로 사용되는 오픈 소스 버전 관리 시스템입니다. Subversion은 코드의 변경 내역을 추적하고 여러

it-racoon.tistory.com


SVN - Apache2 연동하여 사용할때 저장소 경로별 권한설정

  • 2 그룹 teamA 와 teamB 에 속한 userA, userB 가 서로다른 경로의 SVN 저장소를 사용 가정
  • 그룹은 따로 생성하지 않는다.
  • 사용자는 유닉스 계정이 아니고 htpasswd 명령어로 생성
# SVN 서버 폴더 구성
/share/svn/teamA/repo  # 사용권한 userA
/share/svm/teamB/repo  # 사용권한 userB

# 폴더 생성
sudo mkdir -p /share/svn/teamA
sudo mkdir -p /share/svn/teamB

# SVN 저장소 생성
sudo svnadmin create /share/svn/teamA/repo
sudo svnadmin create /share/svm/teamB/repo

# 소유권한 및 접근 권한 설정
sudo chown -R www-data:www-data /share/svn
sudo chmod -R 775 /share/svn

# teamA 유저생성 # passwd 파일 이름을 다르게 설정 # 처음생성시 -c 옵션
sudo htpasswd -c /etc/apache2/dav_svn_teamA.passwd userA

# teamB 유저생성 # passwd 파일 이름을 다르게 설정 # 처음생성시 -c 옵션
sudo htpasswd -c /etc/apache2/dav_svn_teamB.passwd userB

 

  • dav_svn.conf 에서 설정
sudo vi /etc/apache2/mods-enabled/dav_svn.conf

# 기존에 안쓰는 Location 설정은 모두 주석처리 또는 삭제 후 아래와 같이 입력

# teamA
<Location /svn/teamA>
  DAV svn
  SVNParentPath /share/svn/teamA
  AuthType Basic
  AuthName "SVN REPO for teamA"
  AuthUserFile /etc/apache2/dav_svn_teamA.passwd
  Require valid-user
</Location>


# teamB
<Location /svn/teamB>
  DAV svn
  SVNParentPath /share/svn/teamB
  AuthType Basic
  AuthName "SVN REPO for teamB"
  AuthUserFile /etc/apache2/dav_svn_teamB.passwd
  Require valid-user
</Location>

 

  • SVNParentPath 로 접근 가능한 폴더 경로를 설정하고
  • AuthUserFile 경로에  ~.passwd 파일에 저장된 사용자 에게 사용 권한을 부여한다.
  • dav_svn_teamA.passwd 에 등록된 유저 userA 는 /share/svn/teamA/ 경로에 생성되는 저장소에 접근이 가능하다

 

  • 서비스 재시작
# 서비스 재시작으로 변경사항 적용
sudo systemctl restart apache2

 

  • 저장소 주소로 접속할 때 해당 권한이 있는 아이디로 로그인해야한다.
# teamA userA 로 접속
http://serverIP/svn/teamA/repo
# teamB userB 로 접속
http://serverIP/svn/teamB/repo

 

 

  • 공식문서 참조

https://svnbook.red-bean.com/en/1.7/svn.serverconfig.httpd.html#svn.serverconfig.httpd.authn.basic

 

httpd, the Apache HTTP Server

First, configure your master server's httpd.conf file in the usual way. Make the repository available at a certain URI location, and configure authentication and authorization however you'd like. After that's done, configure each of your “slave” server

svnbook.red-bean.com

 

반응형