1.搭建ssh服务器
sudo apt-get install openssh-server
安装完成即可使用2.搭建samba
安装samba:
sudo apt-get install samba
配置:
修改/etc/smb.conf
在smb.conf的最后添加新用户即可: [hello] comment = samba path = /home/hello/work/share browseable = yes guest ok = no writeable = yes其中,[jinwei]是用户名,
path是samba服务器共享目录。 browseable = yes和writeable = yes表明可写可浏览。添加用户,设置密码:
sudo smbpasswd -a hello
设置完成后启动samba服务器即可。测试
在windows中的文件浏览器中输入\server\即可看到hello用户,点击输入用户名和密码即可完成访问:
samba服务器的操作
启动samba服务器:
/etc/init.d/samba start 重启: /etc/init.d/samba restart 查询状态 /etc/init.d/samba status 停止: /etc/init.d/samba stop配置为开机自启动
第一步:
在/etc/init.d新建samba.sh脚本 内容如下:#!/bin/sh ### BEGIN INIT INFO # Provides: samba.sh # Required-start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the svnd.sh daemon # Description: starts svnd.sh using start-stop-daemon ### END INIT INFO /etc/init.d/samba start
第二步:
执行update-rc.d samba.sh defaults取消svn开机自启动
执行:update-rc.d -f samba.sh remove3.搭建svn服务器
安装subversion
sudo apt-get install subversion
创建svn仓库
svnadmin create /xxx/xxxx
第二步:配置
配置三个文件:
1.svnserve.conf 打开所示四项注释,并将anon-access = read改为anon-access = none 。[general] ### The anon-access and auth-access options control access to the ### repository for unauthenticated (a.k.a. anonymous) users and ### authenticated users, respectively. ### Valid values are "write", "read", and "none". ### Setting the value to "none" prohibits both reading and writing; ### "read" allows read-only access, and "write" allows complete ### read/write access to the repository. ### The sample settings below are the defaults and specify that anonymous ### users have read-only access to the repository, while authenticated ### users have read and write access to the repository. anon-access = none auth-access = write ### The password-db option controls the location of the password ### database file. Unless you specify a path starting with a /, ### the file's location is relative to the directory containing ### this configuration file. ### If SASL is enabled (see below), this file will NOT be used. ### Uncomment the line below to use the default password file. password-db = passwd ### The authz-db option controls the location of the authorization ### rules for path-based access control. Unless you specify a path ### starting with a /, the file's location is relative to the ### directory containing this file. The specified path may be a ### repository relative URL (^/) or an absolute file:// URL to a text ### file in a Subversion repository. If you don't specify an authz-db, ### no path-based access control is done. ### Uncomment the line below to use the default authorization file. authz-db = authz
2.passwd
在user后增加“姓名 = 密码”即可### This file is an example password file for svnserve. ### Its format is similar to that of svnserve.conf. As shown in the ### example below it contains one section labelled [users]. ### The name and password for each user follow, one account per line. [users] # harry = harryssecret # sally = sallyssecret aaa = 11223344 bbb = 123456
3.authz
在[groups]下添加分组信息,然后在[/]目录下添加用户和组的访问权限即可: 如:[groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe admin = aaa,bbb [/] @admin = rw
组前面必须加@符号。
启动svn 服务器:
svnserve -d -r /xxx
测试
ubuntu下执行:
svn co svn://svnserver/repo 比如: svn co svn://192.168.1.100/完整举例:
首先创建目录:
cd / mkdir svn cd svn mkdir repo1 mkdir reop2其次,创建仓库
svnadmin create /svn/repo1 svnadmin create /svn/repo2然后分别按照前面所述,配置repo1和repo2的conf/passwd.conf/authz,conf/svnservse.conf三个文件。
然后启动svn服务器:
执行 svnserve -d -r /svn 注意是/svn,而不是/svn/repo1。。。最后测试:
执行svn co svn://192.168.1.100/repo1windows下可安装tortoiseSVN来访问svn服务器。
制作开机自启动脚本
第一步:
在/etc/init.d下新建svnd.sh脚本,内容如下:#!/bin/sh ### BEGIN INIT INFO # Provides: svnd.sh # Required-start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the svnd.sh daemon # Description: starts svnd.sh using start-stop-daemon ### END INIT INFO svnserve -d -r /svn
第二步: 执行update-rc.d svnd.sh defaults 重启即可 取消svn开机自启动 执行:update-rc.d -f svnd.sh remove
精彩评论