Ubuntu 24.04
Sponsored Link

Subversion : アクセス権を設定する2024/07/24

 

[svnserve] を起動している場合の、リポジトリに対するアクセス権の設定です。
([http://] や [file://] でアクセスする場合は無関係)

[1] 例として [/var/svn/repos/project] リポジトリに対するアクセス権を設定します。
root@dlp:~#
vi /var/svn/repos/project/conf/svnserve.conf
# 9行目 : 匿名アクセスを禁止する場合は追記

[general]
anon-access = none
# 28行目 : コメント解除

password-db = passwd
# 37行目 : コメント解除

authz-db = authz
root@dlp:~#
vi /var/svn/repos/project/conf/passwd
# ユーザー名とパスワードを設定

[users]
ubuntu = password
noble = password
debian = password
root@dlp:~#
vi /var/svn/repos/project/conf/authz
# グループと所属ユーザーを定義

[groups]
developer = ubuntu,noble
# ドキュメントルートに対して [developer] グループに読み書き許可

[/]
@developer = rw
# [trunk] フォルダに対して [debian] に読み取り許可

[/trunk]
debian = r
[2] 任意のホストから SVN アクセスして設定を確認します。
ubuntu@node01:~$
svn --username ubuntu list svn://dlp.srv.world/repos/project

Authentication realm: <svn://dlp.srv.world:3690> 84792bc8-15d0-4409-8573-be73eacd8478
Password for 'ubuntu': ********   # [1] で設定したパスワード

branches/
tags/
trunk/

ubuntu@node01:~$
echo 'store-plaintext-passwords = no' >> ~/.subversion/servers
ubuntu@node01:~$
mkdir work3

ubuntu@node01:~$
cd work3

ubuntu@node01:~/work3$
svn --username ubuntu co svn://dlp.srv.world/repos/project

Authentication realm: <svn://dlp.srv.world:3690> 84792bc8-15d0-4409-8573-be73eacd8478
Password for 'ubuntu': ********

A    project/branches
A    project/tags
A    project/trunk
Checked out revision 3.

ubuntu@node01:~/work3$
cd project/trunk
# 適当にバージョン管理下の任意のファイル作成/編集後に
# [debian] ユーザーで [commit]

ubuntu@node01:~/work3/project/trunk$
echo "index.html" > index.html

ubuntu@node01:~/work3/project/trunk$
svn add index.html

ubuntu@node01:~/work3/project/trunk$
svn --username debian ci index.html -m "add new index.html 2024072401"

Authentication realm: <svn://dlp.srv.world:3690> 84792bc8-15d0-4409-8573-be73eacd8478
Password for 'debian': ********

svn: E170001: Commit failed (details follow):
svn: E170001: Authorization failed
# 設定通り拒否された

# [noble] ユーザーで [commit]

ubuntu@node01:~/work3/project/trunk$
svn --username noble ci index.html -m "add new index.html 2024072401"

Authentication realm: <svn://dlp.srv.world:3690> 84792bc8-15d0-4409-8573-be73eacd8478
Password for 'noble': ********

Adding         index.html
Transmitting file data .done
Committing transaction...
Committed revision 4.
# 設定通り [commit] できた

ubuntu@node01:~/work3/project/trunk$
svn update

ubuntu@node01:~/work3/project/trunk$
svn list

index.html
関連コンテンツ