[Original] Quickly build SVN+SSH environment

The deployment method of SVN+SSH mainly uses the tunnel mode of serve to log in to SVN.

Proceed as follows

1 Add a Linux system user. And produce the key, save the authorized_keys file, and specify the command as the tunnel of svnserve, with the svn user name.

2 Modify the config of svn, use authz, and add a linux user.

 

There are a few things to pay attention to when using:

1. svn+ssh, you need to add a linux system user who can log in to the system.

2. After generating the key with ssh-keygen, you need to change it to authorized_keys, and specify the command as the tunnel of svnserve.

3. The checkout is different from the svn method, "svn co svn://192.168.11.6/repos", while the latter is "svn co svn+ssh://[email protected]/svnroot/repos", be sure to Add the path , otherwise it will say that the repository cannot be found.

4. Create a new svn user, specify the authority in auth, specify the password in passwd, and use svn mode to access; at the same time, it can be used as a tunnel in ssh mode.

5. Create a new system user and specify the tunnel in .ssh/authorized_keys .

6. Both svn users and system users need to be added to auth, otherwise it will say Authorized failed.

 

The specific operation steps are as follows:

1 Create a linux user and specify a tunnel

#useradd linuxuser
#printf "123456\n123456" | sudo passwd linuxuser
# su - aaron
#mkdir -p .ssh && cd .ssh
#ssh-keygen -t rsa -b 1024  
#echo -n 'command="/usr/bin/svnserve -t -r /localdisk/svndata --tunnel-user=svnuser"' >> authorized_keys  
#echo -n ',no-port-forwarding,no-pty,no-agent-forwarding,no-X11-forwarding' >> authorized_keys  
#echo -n ' ' >> authorized_keys  
#cat id_rsa.pub >> authorized_keys 

2 Configure svn repos

# cat svnserve.conf 
anon-access =none
auth-access = write
password-db = passwd
authz-db = authz


#cat authz
[/]
svnuser = rw
linuxuser = rw

#cat passwd
[users]
svnuser = 123456

3 Access the svn library

svn co svn+ssh://[email protected] /svnroot/repos //full path

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325265029&siteId=291194637