Ubuntu 26.04

Subversion : アクセス権を設定する2026/07/01

 

[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
resolute = password
ubuntu = password
root@dlp:~#
vi /var/svn/repos/project/conf/authz
# グループと所属ユーザーを定義

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

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

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

Authentication realm: <svn://dlp.srv.world:3690> 3ebc2bba-6fee-4529-b452-4e8075178be2
Password for 'resolute': ********   # [1] で設定したパスワード


-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <svn://dlp.srv.world:3690> 3ebc2bba-6fee-4529-b452-4e8075178be2

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/home/ubuntu/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
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 resolute co svn://dlp.srv.world/repos/project

Authentication realm: <svn://dlp.srv.world:3690> 3ebc2bba-6fee-4529-b452-4e8075178be2
Password for 'resolute': ********

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

ubuntu@node01:~/work3$
cd project/trunk
# 適当にバージョン管理下の任意のファイル作成/編集後に
# [ubuntu] ユーザーで [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 ubuntu ci index.html -m "add new index.html 2026070101"

Authentication realm: <svn://dlp.srv.world:3690> 3ebc2bba-6fee-4529-b452-4e8075178be2
Password for 'ubuntu': ********

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

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

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

Authentication realm: <svn://dlp.srv.world:3690> 3ebc2bba-6fee-4529-b452-4e8075178be2
Password for 'resolute': ********

Adding         index.html
Transmitting file data .done
Committing transaction...
Committed revision 4.
# done normally as settings

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

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

index.html
test.txt
testfile.txt
関連コンテンツ