Sorry, that long ago wrote nothing. Work and experiments with virtualization can be time-consuming. So far nothing new and special constructions, only made some conclusions that will write the final article about KVM.
And now, perhaps, I will write how to quickly set up an FTP server on Debian/Ubuntu. Way to really fast and does not require much digging in the konfigah and bases.
As a basis, as you might guess from the title, I take the vsftpd. Why? Well first its name stands for “very secure ftp daemon. Secondly it can be installed and set up as quickly as possible.
What we get in the end:
1) log in to (you) will be for users. That is, a list of users and their home directories will be taken from the/etc/passwd. Root in the parade is not involved.
2) users cannot get above the home directory in the filesystem. That is, we organize the ftp chroot. Few cases it will prevent end users, but it increases security significantly. Ruth can use sshfs to work with all the FILESYSTEM directly.
3 Anonymous) are disabled. In principle, included 3 lines in the config, but for the purposes of this article, they are not required.
So. Check that there are no fixed ftpd is installed, delete. They don’t need us.
The path for the lazy:
root@Debian:~# aptitude install vsftpd && wget https://debian.pro/files/anlamp/configs/vsftpd.conf -O /etc/vsftpd.conf && /etc/init.d/vsftpd restart
The path for the inquisitive:
Install vsftpd:
root@Debian:~# aptitude install vsftpd
Copy the standard config just in case (optional):
root@Debian:~# cp /etc/vsftpd.conf /etc/vsftpd.conf.default
Clean up the standard config = flood) (generally there wondering, I advise to read like anything.)
root@Debian:~# echo > /etc/vsftpd.conf
And we will begin to write a new one. Actually, to follow the title Very fast way “, propose to take my final config.
Open the/etc/vsftpd.conf our beloved Editor, for example:
root@Debian:~# nano /etc/vsftpd.conf
and paste in the following file:
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
#anon_upload_enable=YES
#anon_mkdir_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
#ascii_upload_enable=YES
#ascii_download_enable=YES
ftpd_banner=Welcome to debian.pro ftpd!
#banned_email_file=/etc/vsftpd.banned_emails
chroot_local_user=YES
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd.chroot_list
ls_recurse_enable=YES
secure_chroot_dir=/var/run/vsftpd
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
#anon_upload_enable=YES
#anon_mkdir_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
#ascii_upload_enable=YES
#ascii_download_enable=YES
ftpd_banner=Welcome to debian.pro ftpd!
#banned_email_file=/etc/vsftpd.banned_emails
chroot_local_user=YES
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd.chroot_list
ls_recurse_enable=YES
secure_chroot_dir=/var/run/vsftpd
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
In the/etc/vsftpd.chroot_list file we can record users, are not covered by rule chroot. In order for this feature to work as rasskomentirujte string #chroot_list_file =/etc/vsftpd.chroot_list in vsftpd.CONF. Oh and don’t forget to create the file:
root@Debian:~# touch /etc/vsftpd.chroot_list
Reload vsftpd:
root@Debian:~# /etc/init.d/vsftpd restart
Come and check out our ftpd. A lot of flooding, further reading is not required) article, in fact, finished:
Try to login as anonymous:
user@desktop:~$ ftp localhost
Connected to localhost.
220 Welcome to debian.pro ftpd!
Name (localhost:inky): anonymous
331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
Connected to localhost.
220 Welcome to debian.pro ftpd!
Name (localhost:inky): anonymous
331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
Try to login as a local user, a little walk in the gift and try to get out of the chroot:
user@desktop:~$ ftp localhost
Connected to localhost.
220 Welcome to debian.pro ftpd!
Name (localhost:inky): inky
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rwxrwxrwx 1 1001 1001 316 Feb 26 17:27 diff.sh
-rwxr-xr-x 1 1001 1001 2281 Feb 26 22:35 diff2.sh
-rw-r–r– 1 1001 1001 1185 Feb 26 20:26 diff2.sh?
-rw-r–r– 1 1001 1001 357 Feb 07 14:47 examples.desktop
drwxr-xr-x 5 1001 1001 4096 Feb 23 05:06 iMacros
-rwxr-xr-x 1 1001 1001 57 Jun 09 15:53 script100
drwxr-xr-x 3 1001 1001 4096 Jul 25 13:10 scripts
-rw-r–r– 1 0 0 30888 Dec 13 2006 thunder.au
-rw-r–r– 1 1001 1001 22626 Feb 26 20:19 thunder2
-rw-r–r– 1 1001 1001 1642496 Feb 26 20:11 thunder2.au
drwxr-xr-x 2 1001 1001 4096 Feb 26 17:27 tmp
-rwxr-xr-x 1 1001 1001 7422 Jun 09 15:43 urgent
226 Directory send OK.
ftp> cd iMacros
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x 2 1001 1001 4096 Feb 22 01:43 Datasources
drwxr-xr-x 5 1001 1001 4096 Apr 11 16:41 Downloads
drwxr-xr-x 2 1001 1001 4096 Feb 22 01:46 Macros
-rwxr-xr-x 1 1001 1001 188 Feb 27 00:19 iMacros.log
226 Directory send OK.
ftp> cd ../
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rwxrwxrwx 1 1001 1001 316 Feb 26 17:27 diff.sh
-rwxr-xr-x 1 1001 1001 2281 Feb 26 22:35 diff2.sh
-rw-r–r– 1 1001 1001 1185 Feb 26 20:26 diff2.sh?
-rw-r–r– 1 1001 1001 357 Feb 07 14:47 examples.desktop
drwxr-xr-x 5 1001 1001 4096 Feb 23 05:06 iMacros
-rwxr-xr-x 1 1001 1001 57 Jun 09 15:53 script100
drwxr-xr-x 3 1001 1001 4096 Jul 25 13:10 scripts
-rw-r–r– 1 0 0 30888 Dec 13 2006 thunder.au
-rw-r–r– 1 1001 1001 22626 Feb 26 20:19 thunder2
-rw-r–r– 1 1001 1001 1642496 Feb 26 20:11 thunder2.au
drwxr-xr-x 2 1001 1001 4096 Feb 26 17:27 tmp
-rwxr-xr-x 1 1001 1001 7422 Jun 09 15:43 urgent
226 Directory send OK.
ftp> cd ../
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rwxrwxrwx 1 1001 1001 316 Feb 26 17:27 diff.sh
-rwxr-xr-x 1 1001 1001 2281 Feb 26 22:35 diff2.sh
-rw-r–r– 1 1001 1001 1185 Feb 26 20:26 diff2.sh?
-rw-r–r– 1 1001 1001 357 Feb 07 14:47 examples.desktop
drwxr-xr-x 5 1001 1001 4096 Feb 23 05:06 iMacros
-rwxr-xr-x 1 1001 1001 57 Jun 09 15:53 script100
drwxr-xr-x 3 1001 1001 4096 Jul 25 13:10 scripts
-rw-r–r– 1 0 0 30888 Dec 13 2006 thunder.au
-rw-r–r– 1 1001 1001 22626 Feb 26 20:19 thunder2
-rw-r–r– 1 1001 1001 1642496 Feb 26 20:11 thunder2.au
drwxr-xr-x 2 1001 1001 4096 Feb 26 17:27 tmp
-rwxr-xr-x 1 1001 1001 7422 Jun 09 15:43 urgent
226 Directory send OK.
Connected to localhost.
220 Welcome to debian.pro ftpd!
Name (localhost:inky): inky
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rwxrwxrwx 1 1001 1001 316 Feb 26 17:27 diff.sh
-rwxr-xr-x 1 1001 1001 2281 Feb 26 22:35 diff2.sh
-rw-r–r– 1 1001 1001 1185 Feb 26 20:26 diff2.sh?
-rw-r–r– 1 1001 1001 357 Feb 07 14:47 examples.desktop
drwxr-xr-x 5 1001 1001 4096 Feb 23 05:06 iMacros
-rwxr-xr-x 1 1001 1001 57 Jun 09 15:53 script100
drwxr-xr-x 3 1001 1001 4096 Jul 25 13:10 scripts
-rw-r–r– 1 0 0 30888 Dec 13 2006 thunder.au
-rw-r–r– 1 1001 1001 22626 Feb 26 20:19 thunder2
-rw-r–r– 1 1001 1001 1642496 Feb 26 20:11 thunder2.au
drwxr-xr-x 2 1001 1001 4096 Feb 26 17:27 tmp
-rwxr-xr-x 1 1001 1001 7422 Jun 09 15:43 urgent
226 Directory send OK.
ftp> cd iMacros
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x 2 1001 1001 4096 Feb 22 01:43 Datasources
drwxr-xr-x 5 1001 1001 4096 Apr 11 16:41 Downloads
drwxr-xr-x 2 1001 1001 4096 Feb 22 01:46 Macros
-rwxr-xr-x 1 1001 1001 188 Feb 27 00:19 iMacros.log
226 Directory send OK.
ftp> cd ../
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rwxrwxrwx 1 1001 1001 316 Feb 26 17:27 diff.sh
-rwxr-xr-x 1 1001 1001 2281 Feb 26 22:35 diff2.sh
-rw-r–r– 1 1001 1001 1185 Feb 26 20:26 diff2.sh?
-rw-r–r– 1 1001 1001 357 Feb 07 14:47 examples.desktop
drwxr-xr-x 5 1001 1001 4096 Feb 23 05:06 iMacros
-rwxr-xr-x 1 1001 1001 57 Jun 09 15:53 script100
drwxr-xr-x 3 1001 1001 4096 Jul 25 13:10 scripts
-rw-r–r– 1 0 0 30888 Dec 13 2006 thunder.au
-rw-r–r– 1 1001 1001 22626 Feb 26 20:19 thunder2
-rw-r–r– 1 1001 1001 1642496 Feb 26 20:11 thunder2.au
drwxr-xr-x 2 1001 1001 4096 Feb 26 17:27 tmp
-rwxr-xr-x 1 1001 1001 7422 Jun 09 15:43 urgent
226 Directory send OK.
ftp> cd ../
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rwxrwxrwx 1 1001 1001 316 Feb 26 17:27 diff.sh
-rwxr-xr-x 1 1001 1001 2281 Feb 26 22:35 diff2.sh
-rw-r–r– 1 1001 1001 1185 Feb 26 20:26 diff2.sh?
-rw-r–r– 1 1001 1001 357 Feb 07 14:47 examples.desktop
drwxr-xr-x 5 1001 1001 4096 Feb 23 05:06 iMacros
-rwxr-xr-x 1 1001 1001 57 Jun 09 15:53 script100
drwxr-xr-x 3 1001 1001 4096 Jul 25 13:10 scripts
-rw-r–r– 1 0 0 30888 Dec 13 2006 thunder.au
-rw-r–r– 1 1001 1001 22626 Feb 26 20:19 thunder2
-rw-r–r– 1 1001 1001 1642496 Feb 26 20:11 thunder2.au
drwxr-xr-x 2 1001 1001 4096 Feb 26 17:27 tmp
-rwxr-xr-x 1 1001 1001 7422 Jun 09 15:43 urgent
226 Directory send OK.
And try to login as root:
user@desktop:~$ ftp localhost
Connected to localhost.
220 Welcome to debian.pro ftpd!
Name (localhost:inky): root
331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
Connected to localhost.
220 Welcome to debian.pro ftpd!
Name (localhost:inky): root
331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
Everything works. Thank you for your attention, good use =)