|

Diegiame PureFTPd (su virtualiais vartotojais ir DB) i CentOS

Diegiame PureFTPd:

yum install pure-ftpd

Sukuriame grupe ir vartotoja prisijungimams:

groupadd -g 2001 ftpgroup
 useradd -u 2001 -s /bin/false -d /bin/null -c "pureftpd user" -g ftpgroup ftpuser

Sukuriame vartotojų duomenų bazę:

# mysql -u root -p
CREATE DATABASE pureftpd;
 GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost' IDENTIFIED BY 'ftpdpass';
 GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost.localdomain' IDENTIFIED BY 'ftpdpass';
 FLUSH PRIVILEGES;

P.S. ftpdpass keičiame į norimą slaptažodį kurį naudos pureftpd

USE pureftpd;
CREATE TABLE ftpd (
 User varchar(16) NOT NULL default '',
 status enum('0','1') NOT NULL default '0',
 Password varchar(64) NOT NULL default '',
 Uid varchar(11) NOT NULL default '-1',
 Gid varchar(11) NOT NULL default '-1',
 Dir varchar(128) NOT NULL default '',
 ULBandwidth smallint(5) NOT NULL default '0',
 DLBandwidth smallint(5) NOT NULL default '0',
 comment tinytext NOT NULL,
 ipaccess varchar(15) NOT NULL default '*',
 QuotaSize smallint(5) NOT NULL default '0',
 QuotaFiles int(11) NOT NULL default 0,
 PRIMARY KEY (User),
 UNIQUE KEY User (User)
 ) ENGINE=MyISAM;
quit;

Konfigūruojame /etc/pure-ftpd/pure-ftpd.conf

nano /etc/pure-ftpd/pure-ftpd.conf

aptikriname:

[...]
ChrootEveryone              yes
[...]
MySQLConfigFile               /etc/pure-ftpd/pureftpd-mysql.conf
[...]
CreateHomeDir               yes
[...]

Koreguojame /etc/pure-ftpd/pureftpd-mysql.conf:

cp /etc/pure-ftpd/pureftpd-mysql.conf /etc/pure-ftpd/pureftpd-mysql.conf_orig
 cat /dev/null > /etc/pure-ftpd/pureftpd-mysql.conf
 nano /etc/pure-ftpd/pureftpd-mysql.conf

turinys:

MYSQLSocket      /var/lib/mysql/mysql.sock
#MYSQLServer     localhost
#MYSQLPort       3306
MYSQLUser       pureftpd
MYSQLPassword   ftpdpass
MYSQLDatabase   pureftpd
#MYSQLCrypt md5, cleartext, crypt() or password() - md5 is VERY RECOMMENDABLE uppon cleartext
MYSQLCrypt      md5
MYSQLGetPW      SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetUID     SELECT Uid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetGID     SELECT Gid FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetDir     SELECT Dir FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetQTASZ   SELECT QuotaSize FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetQTAFS   SELECT QuotaFiles FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")

P.S. pasitikrinkite ar teisingai irašėte ftpdpass

Darome ftp servisą startuojantį sekančios įkrovos metu:

chkconfig --levels 235 pure-ftpd on
 /etc/init.d/pure-ftpd start

Tikriname:

mysql -u root -p
USE pureftpd;

Pvz. sukursime vartotoja exampleuser, status 1 (ftp vartotojas aktyvus), password užkoduotas MD5 funcija, UID ir GID 2001 (userid ir groupid kuri sukureme pradzioje), Dir tai namų katalogas pvz. /home/www.example.com, upload ir download sparta po 100 KB/sec. (kilobytes per second), ir disko kvota quota of 50 MB:

INSERT INTO `ftpd` (`User`, `status`, `Password`, `Uid`, `Gid`, `Dir`, `ULBandwidth`, `DLBandwidth`, `comment`, `ipaccess`, `QuotaSize`, `QuotaFiles`) VALUES ('exampleuser', '1', MD5('secret'), '2001', '2001', '/home/www.example.com', '100', '100', '', '*', '50', '0');
quit;

Pabandome jungtis, po sėkmingo prisijungimo bus sukurtas namų aplankas, galime peržiūrėti:

ls -l /home

Bus kažkas panašaus:

[[email protected] ~]# ls -l /home
 total 4
 drwxr-xr-x 2 ftpuser ftpgroup 4096 Mar  5 02:13 www.example.com
 [[email protected] ~]#
Kviečiu įvertinti įrašą!
[Viso: 0 Vidurkis: 0]

Similar Posts

Parašykite komentarą

El. pašto adresas nebus skelbiamas.

Sauga: + 53 = 56