How the CentOS SVN server manages multiple projects

  • 2021-09-11 21:48:51
  • OfStack

1 Requirements

1 Generally speaking, a company has multiple projects. After building an SVN server, it needs to use SVN to realize that developers who are not in one project cannot access the code in other projects.

Assumptions:

There are 3 projects: project1, project2, project3

There are 6 developers: eg1, eg2, eg3, eg4, eg5, eg6

eg1, eg2, only access to project1;

eg3, eg4, only access to project2;

eg5, eg6, only access to project3;

2 Implementation

Under the repository root path: Assumption is/home/svnroot

cd /home/svnroot

//Create 3 code repositories

svnadmin create project1
svnadmin create project2
svnadmin create project3

//Copy the two permission profiles to the repository root path to manage all code repositories

cd /projcet1/conf
cp authz passwd /home/svnroot

//Open configuration file

vim svnserve.conf

Amend to read as follows:

anon-access = none # Prohibit anonymous access
auth-access = write
password-db = /home/svn/passwd # 1 Using password files
authz-db = /home/svn/authz
realm = project1 # Domain name, very important, write your project name

Modify svnserve. conf of project2, and the above one, and write the last line respectively

anon-access = none # Prohibit anonymous access
auth-access = write
password-db =/home/svn/passwd # Uses password files
authz-db = /home/svn/authz
realm = project2 # Domain name, very important, write your project name

Modify svnserve. conf of project3, and the above one, and write the last line respectively

anon-access = none # Prohibit anonymous access
auth-access = write
password-db = /home/svn/passwd # 1 Using password files
authz-db = /home/svn/authz
realm = project3 # Domain name, very important, write your project name

Modify two rights management files:

cd /home/svnroot
vim passwd

//Username = Password

[users]
eg1 = 123456
eg2 = 123456
eg3 = 123456
eg4 = 123456
eg5 = 123456
eg6 = 123456
vim authz
[groups] # Grouping
admin = eg1,eg2
guest = eg3,eg4
guset1 = eg5,eg6

[/] # Administrator has all read and write permissions
@admin = rw
* =

[project1:/] # Access control for Project 1, guest1, 2 not accessible
@admin = rw
Or
eg1 = rw
eg2 = rw

[project2:/]
@guest = rw
Or
eg3 = rw
eg4 = rw

[project3:/]
@guest1 = rw
Or
eg5 = rw
eg6 = rw

3 Restart

svnserve -d -r /home/svnroot

//Stop command

killall svnserve

4 Actual test

Members of each group can only access their own projects, and have no permission to view other people's projects

Only administrators can view all project projects


Related articles: