知乎專欄 | 多維度架構 | 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者” |
目錄
過程 178.1. install cvs
install
$ sudo apt-get install xinetd $ sudo apt-get install cvs
show the cvs version
$ cvs -v Concurrent Versions System (CVS) 1.12.13 (client/server)
create cvs group and cvsroot user
$ sudo groupadd cvs $ sudo adduser cvsroot --ingroup cvs
change user become cvsroot
$ su - cvsroot
initialization 'CVSROOT'
$ cvs -d /home/cvsroot init
if you have successed, you can see CVSROOT directory in the '/home/cvsroot'
$ ls /home/cvsroot/ CVSROOT
authentication
default SystemAuth=yes, you can use system user to login cvs.
but usually, we don't used system user because it isn't security.
SystemAuth = no
edit '/home/cvsroot/CVSROOT/config' make sure SystemAuth = no
$ vim /home/cvsroot/CVSROOT/config SystemAuth = no
create passwd file
the format is user:password:cvsroot
you need to using htpasswd command, if you don't have, please install it as the following
$ sudo apt-get install apache2-utils
or
$ perl -e 'print("userPassword: ".crypt("secret","salt")."\n");'
or
$ cat passwd #!/usr/bin/perl srand (time()); my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))"; my $salt = sprintf ("%c%c", eval $randletter, eval $randletter); my $plaintext = shift; my $crypttext = crypt ($plaintext, $salt); print "${crypttext}\n"; $ ./passwd "mypasswd" atfodI2Y/dcdc
let's using htpasswd to create a passwd
$ htpasswd -n neo New password: Re-type new password: neo:yA50LI1BkXysY
copy 'neo:yA50LI1BkXysY' and add ':cvsroot' to the end
$ vim /home/cvsroot/CVSROOT/passwd neo:yA50LI1BkXysY:cvsroot nchen:GXaAkSKaQ/Hpk:cvsroot
Go into directory '/etc/xinetd.d/', and then create a cvspserver file as the following.
$ sudo vim /etc/xinetd.d/cvspserver service cvspserver { disable = no flags = REUSE socket_type = stream wait = no user = cvsroot server = /usr/bin/cvs server_args = -f --allow-root=/home/cvsroot pserver log_on_failure += USERID }
check cvspserver in the '/etc/services'
$ grep cvspserver /etc/services cvspserver 2401/tcp # CVS client/server operations cvspserver 2401/udp
restart xinetd
$ /etc/init.d/xinetd Usage: /etc/init.d/xinetd {start|stop|reload|force-reload|restart}
port
$ nmap localhost -p cvspserver Starting Nmap 4.53 ( http://insecure.org ) at 2008-11-14 16:21 HKT Interesting ports on localhost (127.0.0.1): PORT STATE SERVICE 2401/tcp open cvspserver Nmap done: 1 IP address (1 host up) scanned in 0.080 seconds
firewall
$ sudo ufw allow cvspserver
environment variable
CVSROOT=:pserver:username@ip:/home/cvsroot
vim .bashrc export CVS_RSH=ssh export CVSROOT=:pserver:neo@localhost:/home/cvsroot
test
$ cvs login Logging in to :pserver:neo@localhost:2401/home/cvsroot CVS password: neo@netkiller:/tmp/test$ cvs co test cvs checkout: Updating test U test/.project U test/NewFile.xml U test/newfile.php neo@netkiller:/tmp/test$
environment variable
neo@netkiller:~/workspace/cvs$ export CVSROOT=:pserver:neo@localhost:/home/cvsroot
ssh
export CVS_RSH=ssh export CVSROOT=:ext:$USER@localhost:/home/cvsroot