vsftpdA lightweight, efficient FTP server that is positioned as a very secure FTP server. At the moment, vsftpd is used on most servers running linux. Among them are such giants as: ftp.redhat.com, ftp.suse.com, ftp.debian.org, ftp.gnu.org, ftp.gnome.org, ftp.kde.org. I think the comments here are superfluous.
Installing vsftpd without a patch for file names on the fly
If there is no need for transcoding on the fly, then a standard package installed from the official repository with the command is sufficient to install vsftpd:
aptitude install vsftpd
The difference in configuration will be only in the configuration file (below) from which you need to remove the lines:
convert_charset_enable=1 local_charset=UTF8 remote_charset=WIN1251 double_377=0
Install vsftpd with a patch that recodes file names on the fly, use the patch for vsftpd - ext1
vsftpd-2.1.0+ (ext build 1) released
What this patch adds to the server:
1. Added character conversion between some code pages.
2. Support for access rules for anonymous users has been added.
3. Added rules for user access from certain addresses.
4. Allow or prohibit the deletion of files by anonymous users.
5. Added the ability to change the owner of the downloaded file by an anonymous user on his IP.
6. The double_377 parameter is added (installed in 1), which allows you to disable the specific telnet protocol symbol with the code \377 (255 \0xFF).
7. Changed the algorithm for searching libraries in "vsf_findlibs.sh".
8. The ability to set different speeds on upload and download files.
9. The rest of the functions were removed from the extended build.
Task:
Create a directory in which an anonymous person can write, but he is forbidden to create folders, edit and delete folders and files. Create a user who can manage everything inside the folder.
If you wish, you can go to the website. http://vsftpd.devnet.ru Download new patches and patch with new ones yourself. I don’t see the point yet – the functionality suits me completely (but of course, if there are numerous requests and there will be time, then maybe), the server configured on this software works stably and trouble-free for several years.
So let's get started.
If you are lazy to collect the package yourself, you can download from me for the Debian distribution at the links:
Download vsftpd_ext1 for Debian Lenny on amd64
Download from Debian Lenny server console to amd64 architecture:
wget http://vkusnoserver.pp.ua/downloads/ftp/vsftpd-ext_2.1.0-ext1_amd64.deb
Install the package with the command:
dpkg -i vsftpd-ext_2.1.0-ext1_amd64.deb
Download vsftpd_ext1 for Debian Squeeze on i386
Download from the Debian Squeeze server console to the i386 architecture:
wget http://softnastroy.com/downloads/ftp/vsftpd-ext_2.1.0-ext1_i386.deb
Install the package with the command:
dpkg -i vsftpd-ext_2.1.0-ext1_i386.deb
! Attention. If after installation, the system swears that the package is not configured, execute a command that will independently establish all missing dependencies:
apt-get -f install
VSFTPD with a transcoding patch on the fly is installed.
Setting up the ftp server is below in the instructions.
If you want, you can install the package yourself from the source code, then we will begin.
On the server, create a folder in which we will perform all the assembly and installation actions and go to it under the root user:
mkdir -p /usr/src/ftp cd /usr/src/ftp
Now we download the source vsftpd with the patch:
wget http://softnastroy.com/downloads/ftp/vsftpd-ext_2.1.0-ext1.diff.gz wget http://softnastroy.com/downloads/ftp/vsftpd-ext_2.1.0-ext1.dsc wget http://softnastroy.com/downloads/ftp/vsftpd-ext_2.1.0.orig.tar.gz
Add the source repository to the file /etc/apt/sources.list
deb http://mirror.yandex.ru/debian squeeze main contrib non-free deb-src http://mirror.yandex.ru/debian squeeze main
Updating the repository:
aptitude update
Install the software for assembling the package:
aptitude install build-essential
Next, we apply a patch to the source with automatic unpacking:
dpkg-source -x vsftpd-ext_2.1.0-ext1.dsc dpkg-source: предупреждение: распаковка неподписанного пакета с исходным кодом (vsftpd-ext_2.1.0-ext1.dsc) dpkg-source: инфо: извлечение vsftpd-ext в vsftpd-ext-2.1.0 dpkg-source: инфо: распаковывается vsftpd-ext_2.1.0.orig.tar.gz dpkg-source: инфо: накладывается vsftpd-ext_2.1.0-ext1.diff.gz
Then we go to the unpacked folder:
cd vsftpd-ext-2.1.0/
We start the installation of packages necessary for the assembly of source materials:
apt-get build-dep vsftpd
And assemble the package with a team:
dpkg-buildpackage -rfakeroot
After assembly, move to the directory up:
cd ..
and executing the command ls, we see that the deb packet is assembled:
ls vsftpd-ext-2.1.0 vsftpd-ext_2.1.0-ext1.dsc vsftpd-ext_2.1.0-ext1_i386.deb vsftpd-ext_2.1.0-ext1.diff.gz vsftpd-ext_2.1.0-ext1_i386.changes vsftpd-ext_2.1.0.orig.tar.gz
Install the collected package vsftpd command:
dpkg -i vsftpd-ext_2.1.0-ext1_i386.deb Выбор ранее не выбранного пакета vsftpd-ext. (Чтение базы данных ... на данный момент установлено 44980 файлов и каталогов.) Распаковывается пакет vsftpd-ext (из файла vsftpd-ext_2.1.0-ext1_i386.deb)... Настраивается пакет vsftpd-ext (2.1.0-ext1) ... Starting FTP server: vsftpd. Обрабатываются триггеры для man-db ...
Configuration file vsftpd server is located at /etc/vsftpd.conf
My working configuration file (you can copy and paste it into yours):
listen=YES anonymous_enable=YES local_enable=YES write_enable=YES local_umask=000 anon_upload_enable=YES anon_umask=000 anon_mkdir_write_enable=NO dirmessage_enable=YES use_localtime=YES xferlog_enable=YES connect_from_port_20=YES xferlog_file=/var/log/vsftpd.log ftpd_banner=Welcome to FTP server firm name. chroot_local_user=YES secure_chroot_dir=/var/run/vsftpd/empty pam_service_name=vsftpd-ext rsa_cert_file=/etc/ssl/private/vsftpd.pem convert_charset_enable=1 local_charset=UTF8 remote_charset=WIN1251 double_377=0
Configure anonym and ftp server administrator
Add a user who will administer the folder configured below:
adduser ftpadmin
Team team.
cat /etc/passwd | grep ftp
The following information is displayed by the ftp user:
ftp:x:105:107:ftp daemon,,,:/srv/ftp:/bin/false
We see that the user's home folder /srv/ftpIt fits us and we won't change it.
Therefore, this folder and we will configure as the main one for working with FTP.
Add an existing user ftpadmin group ftp team:
usermod -a -G ftp ftpadmin
Create it inside. /srv/ftp A folder in which an anonymous user can create and download files:
mkdir -p /srv/ftp/upload chmod -R 777 /srv/ftp/upload
Create a folder inside which an anonymous person cannot enter, only for the administrator:
mkdir -p /srv/ftp/install
All rights to the folder are granted to the administrator user and his group, all others (including an anonymous one) go to the forest.
chmod -R 770 /srv/ftp/install
Change the home folder for ftpadmin user to a folder /srv/ftp/
usermod -d /srv/ftp/ ftpadmin
Change the user and group for the home folder:
chown -R ftpadmin:ftpadmin /srv/ftp/
We overload the server with a command:
reboot
And after the restart, we try to connect anonymously, fill in the file and try to delete it, as well as check the work under the ftpadmin user.
And then it's just by analogy. Add (if necessary) administrators and all.
P.S. This instruction is relevant only if there are few users, but if there are a lot of users, it is better to use virtual users rather than system users.



comment