Programing

SVN에서 액세스 제어를 설정하려면 어떻게해야합니까?

crosscheck 2020. 10. 10. 09:38
반응형

SVN에서 액세스 제어를 설정하려면 어떻게해야합니까?


SVN을 사용하여 저장소를 설정하고 프로젝트를 업로드했습니다. 이 프로젝트에서 작업하는 여러 사용자가 있습니다. 그러나 모든 사람이 모든 프로젝트에 액세스해야하는 것은 아닙니다. 각 프로젝트에 대한 사용자 권한을 설정하고 싶습니다.

이것을 어떻게 할 수 있습니까?


SVN \의 repos \ YourRepo \ conf의 폴더에 두 개의 파일을 찾을 수 에는 AuthZpasswd를을 . 이것들은 조정해야 할 두 가지입니다.

에서 passwd에 파일 일부 사용자 이름과 암호를 추가해야합니다. 나는 당신이 그것을 사용하는 사람들이 있기 때문에 이미 이것을했다고 가정합니다.

[users]
User1=password1
User2=password2

그런 다음 authz 파일 에 따라 권한을 할당하려고 합니다.

원하는 개념 그룹을 만들고 여기에 사람을 추가합니다.

[groups]
allaccess = user1
someaccess = user2

그런 다음 권한과 프로젝트 수준 모두에서 어떤 액세스 권한이 있는지 선택합니다.

그래서 우리의 "모든 액세스"사람들에게 루트로부터의 모든 액세스 권한을 부여합시다.

[/]
@allaccess = rw

그러나 우리의 "일부 액세스"사람에게 일부 하위 수준 프로젝트에 대한 읽기 전용 액세스 권한 만 부여하십시오.

[/someproject]
@someaccess = r

또한 authzpasswd 파일 에서 몇 가지 간단한 문서를 찾을 수 있습니다.


@ 스티븐 베일리

답변을 완성하기 위해 저장소의 일반 텍스트 파일을 통해 프로젝트 관리자에게 사용자 권한을 위임 할 수도 있습니다.

이를 위해 authz다음을 포함 하는 기본 파일로 SVN 데이터베이스를 설정합니다 .

###########################################################################
# The content of this file always precedes the content of the
# $REPOS/admin/acl_descriptions.txt file.
# It describes the immutable permissions on main folders.
###########################################################################
[groups]
svnadmins = xxx,yyy,....

[/]
@svnadmins = rw
* = r
[/admin]
@svnadmins = rw
@projadmins = r
* =

[/admin/acl_descriptions.txt]
@projadmins = rw

이 기본 authz파일은 SVN 관리자가 SVN 저장소 내에서 보이는 일반 텍스트 파일 인 '/admin/acl_descriptions.txt' 를 수정할 수있는 권한을 부여합니다 . 여기서 SVN 관리자 또는 프로젝트 관리자는 사용자를 수정하고 등록합니다.

그런 다음 리비전이 해당 파일 (및 해당 파일 만)로 구성되었는지 감지하는 사전 커밋 후크를 설정합니다.

그렇다면이 후크의 스크립트는 일반 텍스트 파일의 내용을 확인하고 각 행이 SVN 구문을 준수하는지 확인합니다.

그런 다음 커밋 후 후크는 \conf\authz다음을 연결 하여 파일을 업데이트합니다 .

  • authz위에 제시된 TEMPLATE 파일
  • 일반 텍스트 파일 /admin/acl_descriptions.txt

첫 번째 반복은 다음을 추가하는 SVN 관리자가 수행합니다.

[groups]
projadmins = zzzz

He commits his modification, and that updates the authz file.

Then the project manager 'zzzz' can add, remove or declare any group of users and any users he wants. He commits the file and the authz file is updated.

That way, the SVN administrator does not have to individually manage any and all users for all SVN repositories.


One gotcha which caught me out:

[repos:/path/to/dir/] # this won't work

but

[repos:/path/to/dir]  # this is right

You need to not include a trailing slash on the directory, or you'll see 403 for the OPTIONS request.


You can use svn+ssh:, and then it's based on access control to the repository at the given location.

This is how I host a project group repository at my uni, where I can't set up anything else. Just having a directory that the group owns, and running svn-admin (or whatever it was) in there means that I didn't need to do any configuration.


Although I would suggest the Apache approach is better, SVN Serve works fine and is pretty straightforward.

Assuming your repository is called "my_repo", and it is stored in C:\svn_repos:

  1. Create a file called "passwd" in "C:\svn_repos\my_repo\conf". This file should look like:

    [Users]
    username = password
    john = johns_password
    steve = steves_password
    
  2. In C:\svn_repos\my_repo\conf\svnserve.conf set:

    [general]
    password-db = passwd
    auth-access=read
    auth-access=write
    

This will force users to log in to read or write to this repository.

Follow these steps for each repository, only including the appropriate users in the passwd file for each repository.


The best way is to set up Apache and to set the access through it. Check the svn book for help. If you don't want to use Apache, you can also do minimalistic access control using svnserve.

참고URL : https://stackoverflow.com/questions/81361/how-do-i-set-up-access-control-in-svn

반응형