<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux for Fun &#187; Network</title>
	<atom:link href="http://linuxforfun.net/category/network/feed/" rel="self" type="application/rss+xml" />
	<link>http://linuxforfun.net</link>
	<description>Just for Fun</description>
	<lastBuildDate>Tue, 15 Sep 2009 00:12:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using `cvsd&#8217; to setup cvs pserver</title>
		<link>http://linuxforfun.net/2008/04/27/cvsd-setup-cvs-pserver/</link>
		<comments>http://linuxforfun.net/2008/04/27/cvsd-setup-cvs-pserver/#comments</comments>
		<pubDate>Sun, 27 Apr 2008 12:00:52 +0000</pubDate>
		<dc:creator>sandajian</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[cvs]]></category>
		<category><![CDATA[cvsd]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://linuxforfun.net/?p=16</guid>
		<description><![CDATA[CVS was designed to use `xinetd&#8217; to startup service. But now most Linux distributions do not install xinetd by default, and configuration of CVS is somewhat complicated. `cvsd&#8216; is a wrapper program for CVS in pserver mode, it can startup CVS as a standalone daemon, under a special uid/gid in a chroot jail. It is [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Using `cvsd&#8217; to setup cvs pserver", url: "http://linuxforfun.net/2008/04/27/cvsd-setup-cvs-pserver/" });</script>]]></description>
			<content:encoded><![CDATA[<p>CVS was designed to use `xinetd&#8217; to startup service.  But now most Linux distributions do not install xinetd by default, and configuration of CVS is somewhat complicated. `<a href="http://ch.tudelft.nl/~arthur/cvsd/">cvsd</a>&#8216; is a wrapper program for CVS in pserver mode, it can startup CVS as a standalone daemon, under a special uid/gid in a chroot jail.  It is relatively easy to use cvsd and its configuration file to setup CVS repositories.</p>
<p>In this article, I will describe how to setup a cvs pserver step by step.</p>
<p><strong>1. Installation of cvsd package</strong></p>
<p>For RPM-based distributions, you may download precompiled RPMS from this site:</p>
<blockquote><p><a href="http://linuxforfun.net/misc/cvsd-1.0.14-1.i386.rpm">cvsd-1.0.14-1.i386.rpm</a><br />
<a href="http://linuxforfun.net/misc/cvsd-1.0.14-1.src.rpm">cvsd-1.0.14-1.src.rpm</a> (source)</p></blockquote>
<p>For other distributions, you may download source tarball <a href="http://ch.tudelft.nl/~arthur/cvsd/downloads.html">here</a>, compile and install it yourself.</p>
<p><span id="more-16"></span></p>
<p><strong>2. Configuration file /etc/cvsd/cvsd.conf</strong></p>
<p>Check cvsd&#8217;s configuration file /etc/cvsd/cvsd.conf.   Something should be mentioned:</p>
<ul>
<li>RootJail: the location of the chroot jail cvs should be run in.  The default value should like<br />
<blockquote><p><code>RootJail /var/lib/cvsd</code></p></blockquote>
<p>For RPM-based installation, the installation process should have initialized this directory for you, by the command</p>
<blockquote><p><code># cvsd-buildroot /var/lib/cvsd</code></p></blockquote>
<p>If the directory is not initialized yet, or you change `RootJail&#8217; to another directory, you need to use the command `cvsd-buildroot&#8217; to initialize it by hand.</li>
<li>Uid and Gid: the user and group cvsd should be run as.  The default values:<br />
<blockquote><p><code>Uid cvsd<br />
Gid cvsd</code></p></blockquote>
<p>For non-RPM based installation, you need to create them by hand.</li>
<li>Repos: paths to repositories, one repository per line. Every path is relative to RootJail and begins with a `/&#8217;.  For example:<br />
<blockquote><p><code>Repos /coolsoft<br />
Repos /hotsoft</code></p></blockquote>
</li>
</ul>
<p><strong>3. Creation of repositories</strong></p>
<p>To create a repository, for example, `coolsoft&#8217;, use the command:</p>
<blockquote><p><code># cvs -d /var/lib/cvsd/coolsoft init</code></p></blockquote>
<p>The command will create a directory /var/lib/cvsd/coolsoft and a CVSROOT tree in it.</p>
<p>If you allow users to create top level directories in this repository:</p>
<blockquote><p><code># chown cvsd:cvsd /var/lib/cvsd/coolsoft</code></p></blockquote>
<p>Edit the file <code>/var/lib/cvsd/coolsoft/CVSROOT/config</code> and modify the `LockDir&#8217; option:</p>
<blockquote><p><code>LockDir /tmp/coolsoft</code></p></blockquote>
<p>The directory is relative to `RootJail&#8217;, /var/lib/cvsd. Create the directory:</p>
<blockquote><p><code># mkdir /var/lib/cvsd/tmp/coolsoft<br />
# chown cvsd:cvsd /var/lib/cvsd/tmp/coolsoft</code></p></blockquote>
<p>Now create users that can access this repository and set the passwords:</p>
<blockquote><p><code># cvsd-passwd /var/lib/cvsd/coolsoft jack</code></p></blockquote>
<p>If you want anonymous access to your repository, create a user named `anonymous&#8217; or `anoncvs&#8217;, and leave the password blank:</p>
<blockquote><p><code># cvsd-passwd /var/lib/cvsd/coolsoft anoncvs</code></p></blockquote>
<p>Create a new file <code>/var/lib/cvsd/coolsoft/CVSROOT/writers</code>:</p>
<blockquote><p><code># touch /var/lib/cvsd/coolsoft/CVSROOT/writers</code></p></blockquote>
<p>to protect write access to the repository.  Without this file, all users have write access!  Add users you want write access to this file, one user per line.</p>
<p>Optional, create top level directories in your repository that will hold files committed:</p>
<blockquote><p><code># cd /var/lib/cvsd/coolsoft<br />
# mkdir client server<br />
# chown cvsd:cvsd client server</code></p></blockquote>
<p><strong>4. Startup cvsd and test your repositories</strong></p>
<p>To startup cvsd, use the command</p>
<blockquote><p><code># /etc/init.d/cvsd start</code></p></blockquote>
<p>To test the new repository:</p>
<blockquote><p><code># cvs -d :pserver:jack@myhost.at.office/coolsoft login<br />
# cvs -d :pserver:jack@myhost.at.office/coolsoft co client</code></p></blockquote>
<p><a href="http://sharethis.com/item?&wp=3.0.1&amp;publisher=0528fcb2-917b-4b68-8e53-491409263a87&amp;title=Using+%60cvsd%26%238217%3B+to+setup+cvs+pserver&amp;url=http%3A%2F%2Flinuxforfun.net%2F2008%2F04%2F27%2Fcvsd-setup-cvs-pserver%2F">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://linuxforfun.net/2008/04/27/cvsd-setup-cvs-pserver/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setup of VSFTPD &#8211; another approach</title>
		<link>http://linuxforfun.net/2008/04/15/vsftpd-virtual-users-another-approach/</link>
		<comments>http://linuxforfun.net/2008/04/15/vsftpd-virtual-users-another-approach/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 15:35:51 +0000</pubDate>
		<dc:creator>sandajian</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[virtual users]]></category>
		<category><![CDATA[vsftpd]]></category>

		<guid isPermaLink="false">http://linuxforfun.net/?p=15</guid>
		<description><![CDATA[If you are hosting several web sites, for security reason, you may want the webmasters to access their own files only. One of the good way is to give them FTP access by setup of VSFTPD virtual users and directories. In my last article, I described how to setup VSFTPD virtual users. In this article, [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Setup of VSFTPD &#8211; another approach", url: "http://linuxforfun.net/2008/04/15/vsftpd-virtual-users-another-approach/" });</script>]]></description>
			<content:encoded><![CDATA[<p>If you are hosting several web sites, for security reason, you may want the webmasters to access their own files only.  One of the good way is to give them FTP access by setup of VSFTPD virtual users and directories.</p>
<p>In my <a href="http://linuxforfun/2008/04/05/vsftpd-virtual-users/" target="_blank">last article</a>, I described how to setup VSFTPD virtual users.  In this article, I will describe another approach to setup VSFTPD, it needs real users on the system.</p>
<p><strong>1. Installation of VSFTPD</strong></p>
<p>For Red Hat, CentOS and Fedora, you may install VSFTPD by the command</p>
<blockquote><p><code># yum install vsftpd</code></p></blockquote>
<p>For Debian and Ubuntu,</p>
<blockquote><p><code># apt-get install vsftpd</code></p></blockquote>
<p><span id="more-15"></span><strong>2. Virtual users and authentication</strong></p>
<p>We may create a real user account for each webmaster.  We will only give them FTP access to our server.</p>
<p>First, use `useradd&#8217; command to create user accounts.  Something to be specified are:</p>
<ul>
<li><strong>group</strong>: we may specify the group of users to the group HTTP server runs as.  In most cases, it is `apache&#8217; for Apache HTTP Server, it is `lighttpd&#8217; for lighttpd.</li>
<li><strong>home directory</strong>: we should also specify users&#8217; home directories to their virtual hosts&#8217; DocumentRoot.  We should also make these directories writable by HTTP server.</li>
<li><strong>login shell</strong>: in order to disallow normal login for these FTP users, we should specify their login shell to `/sbin/nologin&#8217;.</li>
</ul>
<p>For example:</p>
<blockquote><p><code># useradd -g apache -d /var/www/vhosts/mike -s /sbin/nologin mike<br />
# chmod g+w /var/www/vhosts/mike<br />
# passwd mike<br />
Changing password for user mike.<br />
New UNIX password:<br />
Retype new UNIX password:<br />
passwd: all authentication tokens updated successfully.</code></p></blockquote>
<p><strong>3. Configuration of VSFTPD</strong></p>
<p>Create a configuration file /etc/vsftpd/vsftpd-virtual.conf,</p>
<blockquote><p><code># disables anonymous FTP<br />
anonymous_enable=NO<br />
# enables non-anonymous FTP<br />
local_enable=YES<br />
# enables uploads and new directories<br />
write_enable=YES<br />
# authentication of virtual uses<br />
pam_service_name=login<br />
# the virtual user is restricted to the virtual FTP area<br />
chroot_local_user=YES<br />
# runs vsftpd in standalone mode<br />
listen=YES<br />
# listens on this port for incoming FTP connections<br />
listen_port=60021<br />
# the minimum port to allocate for PASV style data connections<br />
pasv_min_port=62222<br />
# the maximum port to allocate for PASV style data connections<br />
pasv_max_port=63333<br />
# controls whether PORT style data connections use port 20 (ftp-data)<br />
connect_from_port_20=YES<br />
# the umask for file creation<br />
local_umask=022</code></p></blockquote>
<p><strong>4. Start VSFTPD and test</strong><br />
Now we can start VSFTPD by the command:</p>
<blockquote><p><code># /usr/sbin/vsftpd /etc/vsftpd/vsftpd-virtual.conf</code></p></blockquote>
<p>and test the FTP access of a virtual user:</p>
<blockquote><p><code># lftp -u mike -p 60021 192.168.1.101</code></p></blockquote>
<p>The virtual user should have full access to his directory.</p>
<p><a href="http://sharethis.com/item?&wp=3.0.1&amp;publisher=0528fcb2-917b-4b68-8e53-491409263a87&amp;title=Setup+of+VSFTPD+%26%238211%3B+another+approach&amp;url=http%3A%2F%2Flinuxforfun.net%2F2008%2F04%2F15%2Fvsftpd-virtual-users-another-approach%2F">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://linuxforfun.net/2008/04/15/vsftpd-virtual-users-another-approach/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Setup of VSFTPD virtual users</title>
		<link>http://linuxforfun.net/2008/04/05/vsftpd-virtual-users/</link>
		<comments>http://linuxforfun.net/2008/04/05/vsftpd-virtual-users/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 08:12:53 +0000</pubDate>
		<dc:creator>sandajian</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[virtual users]]></category>
		<category><![CDATA[vsftpd]]></category>

		<guid isPermaLink="false">http://linuxforfun.net/2008/04/05/vsftpd-virtual-users/</guid>
		<description><![CDATA[If you are hosting several web sites, for security reason, you may want the webmasters to access their own files only. One of the good way is to give them FTP access by setup of VSFTPD virtual users and directories. This article describes how you can do that easily. (See also: Setup of VSFTPD virtual [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Setup of VSFTPD virtual users", url: "http://linuxforfun.net/2008/04/05/vsftpd-virtual-users/" });</script>]]></description>
			<content:encoded><![CDATA[<p>If you are hosting several web sites, for security reason, you may want the webmasters to access their own files only.  One of the good way is to give them FTP access by setup of VSFTPD virtual users and directories.  This article describes how you can do that easily.<br />
(See also: <a href="http://linuxforfun.net/2008/04/15/vsftpd-virtual-users-another-approach/">Setup of VSFTPD virtual users &#8211; another approach</a>)</p>
<p><strong>1. Installation of VSFTPD</strong></p>
<p>For Red Hat, CentOS and Fedora, you may install VSFTPD by the command</p>
<blockquote><p><code># yum install vsftpd</code></p></blockquote>
<p>For Debian and Ubuntu,</p>
<blockquote><p><code># apt-get install vsftpd</code></p></blockquote>
<p><span id="more-13"></span><strong>2. Virtual users and authentication</strong></p>
<p>We are going to use pam_userdb to authenticate the virtual users. This needs a username / password file in `db&#8217; format &#8211; a common database format.   We need `db_load&#8217; program.   For CentOS, Fedora, you may install the package `db4-utils&#8217;:</p>
<blockquote><p><code># yum install db4-utils</code></p></blockquote>
<p>For Ubuntu,</p>
<blockquote><p><code># apt-get install db4.2-util</code></p></blockquote>
<p>To create a `db&#8217; format file, first create a plain text file `virtual-users.txt&#8217; with the usernames and passwords on alternating lines:</p>
<blockquote><p><code>mary<br />
123456<br />
jack<br />
654321</code></p></blockquote>
<p>Then execute the following command to create the actual database:</p>
<blockquote><p><code># db_load -T -t hash -f virtual-users.txt /etc/vsftpd/virtual-users.db</code></p></blockquote>
<p>Now, create a PAM file /etc/pam.d/vsftpd-virtual which uses your database:</p>
<blockquote><p><code>auth required pam_userdb.so db=/etc/vsftpd/virtual-users<br />
account required pam_userdb.so db=/etc/vsftpd/virtual-users</code></p></blockquote>
<p><strong>3. Configuration of VSFTPD</strong></p>
<p>Create a configuration file /etc/vsftpd/vsftpd-virtual.conf,</p>
<blockquote><p><code># disables anonymous FTP<br />
anonymous_enable=NO<br />
# enables non-anonymous FTP<br />
local_enable=YES<br />
# activates virtual users<br />
guest_enable=YES<br />
# virtual users to use local privs, not anon privs<br />
virtual_use_local_privs=YES<br />
# enables uploads and new directories<br />
write_enable=YES<br />
# the PAM file used by authentication of virtual uses<br />
pam_service_name=vsftpd-virtual<br />
# in conjunction with 'local_root',<br />
# specifies a home directory for each virtual user<br />
user_sub_token=$USER<br />
local_root=/var/www/virtual/$USER<br />
# the virtual user is restricted to the virtual FTP area<br />
chroot_local_user=YES<br />
# hides the FTP server user IDs and just display "ftp" in directory listings<br />
hide_ids=YES<br />
# runs vsftpd in standalone mode<br />
listen=YES<br />
# listens on this port for incoming FTP connections<br />
listen_port=60021<br />
# the minimum port to allocate for PASV style data connections<br />
pasv_min_port=62222<br />
# the maximum port to allocate for PASV style data connections<br />
pasv_max_port=63333<br />
# controls whether PORT style data connections use port 20 (ftp-data)<br />
connect_from_port_20=YES<br />
# the umask for file creation<br />
local_umask=022</code></p></blockquote>
<p><strong>4. Creation of home directories</strong></p>
<p>Create each user&#8217;s home directory in /var/www/virtual, and change the owner of the directory to the user `ftp&#8217;:</p>
<blockquote><p><code># mkdir /var/www/virtual/mary<br />
# chown ftp:ftp /var/www/virtual/mary</code></p></blockquote>
<p><strong>5. Startup of VSFTPD and test</strong><br />
Now we can start VSFTPD by the command:</p>
<blockquote><p><code># /usr/sbin/vsftpd /etc/vsftpd/vsftpd-virtual.conf</code></p></blockquote>
<p>and test the FTP access of a virtual user:</p>
<blockquote><p><code># lftp -u mary -p 60021 192.168.1.101</code></p></blockquote>
<p>The virtual user should have full access to his directory.</p>
<p><a href="http://sharethis.com/item?&wp=3.0.1&amp;publisher=0528fcb2-917b-4b68-8e53-491409263a87&amp;title=Setup+of+VSFTPD+virtual+users&amp;url=http%3A%2F%2Flinuxforfun.net%2F2008%2F04%2F05%2Fvsftpd-virtual-users%2F">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://linuxforfun.net/2008/04/05/vsftpd-virtual-users/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
