4. ProFTPd’ nin konfigurasyonu

/etc/proftpd/proftpd.conf dosyasini aciyoruz ve  UseIPv6 secenegini off yapiyoruz;

vi /etc/proftpd/proftpd.conf

[…]
UseIPv6                         off
[…]

Ayni dosyada asagidaki degisiklikleri yapiyoruz;

[…]
DefaultRoot ~
# The passwords in MySQL are encrypted using CRYPT
SQLAuthTypes            Plaintext Crypt
SQLAuthenticate         users groups
# used to connect to the database
# databasename@host database_user user_password
SQLConnectInfo  ftp@localhost proftpd dinopsysftp
# Here we tell ProFTPd the names of the database columns in the “usertable”
# we want it to interact with. Match the names with those in the db
SQLUserInfo     ftpuser userid passwd uid gid homedir shell
# Here we tell ProFTPd the names of the database columns in the “grouptable”
# we want it to interact with. Again the names match with those in the db
SQLGroupInfo    ftpgroup groupname gid members
# set min UID and GID – otherwise these are 999 each
SQLMinID        500

# create a user’s home directory on demand if it doesn’t exist
SQLHomedirOnDemand on

# Update count every time user logs in
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE “count=count+1, accessed=now() WHERE userid=’%u'” ftpuser

# Update modified everytime user uploads or deletes a file
SQLLog  STOR,DELE modified
SQLNamedQuery modified UPDATE “modified=now() WHERE userid=’%u'” ftpuser

# User quotas
# ===========
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on

SQLNamedQuery get-quota-limit SELECT “name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM ftpquotalimits WHERE name = ‘%{0}’ AND quota_type = ‘%{1}'”

SQLNamedQuery get-quota-tally SELECT “name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM ftpquotatallies WHERE name = ‘%{0}’ AND quota_type = ‘%{1}'”

SQLNamedQuery update-quota-tally UPDATE “bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, files_xfer_used = files_xfer_used + %{5} WHERE name = ‘%{6}’ AND quota_type = ‘%{7}'” ftpquotatallies

SQLNamedQuery insert-quota-tally INSERT “%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}” ftpquotatallies

QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally

RootLogin off
RequireValidShell off
[…]

/etc/proftpd/modules.conf dosyasini aciyoruz ve LoadModule mod_sql_postgres.c satirinin basina # koymak kaydi ile kapatiyoruz.

vi /etc/proftpd/modules.conf

[…]
#LoadModule mod_sql_postgres.c
[…]

ve yaptigimiz ayarlarin gecerli olmasi icin simdi proftpd yi yeniden baslatiyoruz;

/etc/init.d/proftpd restart  

5. Database’ e Kullanici Eklemek ve Test Etmek

mysql -u root -p

Komutu ile mysql shelline rootu olarak login oluyoruz ve

USE ftp;

komutu ile ftp database’ ine gecis yapiyoruz.

INSERT INTO `ftpgroup` (`groupname`, `gid`, `members`) VALUES (‘ftpgroup’, 2007, ‘ftpuser’);

Kullanici ve grup eklerken 2007 den farkli bir id kullandiysaniz lutfen ona gore duzenleyin.

ftpgroup tablosu ile isimiz bitti. Simdi yeni kullanici olusturmak istiyoruz ve bunun icin ftpquotalimits ve ftpuser tablolarini kullanmamiz gerekiyor. Ornek olarak dinopsysuser kullanici isimli 15MB kotasi olan sifresi dinopsys olan bir kullanici olusturuyoruz.

INSERT INTO `ftpquotalimits` (`name`, `quota_type`, `per_session`, `limit_type`, `bytes_in_avail`, `bytes_out_avail`, `bytes_xfer_avail`, `files_in_avail`, `files_out_avail`, `files_xfer_avail`) VALUES (‘dinopsysuser’, ‘user’, ‘true’, ‘hard’, 15728640, 0, 0, 0, 0, 0);

INSERT INTO `ftpuser` (`id`, `userid`, `passwd`, `uid`, `gid`, `homedir`, `shell`, `count`, `accessed`, `modified`) VALUES (1, ‘dinopsysuser’, ‘dinopsys’, 2007, 2007, ‘/home/www.dinopsys.net’, ‘/sbin/nologin’, 0, ”, ”);

quit;

komutu ile tekrar sistem shelline donuyoruz. Tekrar uyarmakta fayda goruyorum; eger makaleye bagli kalmadan kurulum yapiyorsaniz ve user-group olustururken 2007 disinda bir id verdiyseniz buralari o id ye gore duzenleyin.

Simdi ne yaptigimiza gelelim;

/home dizini altinda www.dinopsys.net dizininde dinopsysuser kullanicina dinopsys sifresi ile 15 MB lik bir alan tanimladik.

ls -l /home

komutu ile home dizinine bakiyoruz ve www.dinopsys.net dizinin otomatik olarak olusturuldugunu ve haklarinin ftpuser – ftpgroup’ a verildigini goruyoruz.

server1:~# ls -l /home/
total 8
drwxr-xr-x 2 ftp           nogroup       4096 2007-05-03 08:50 ftp
drwxr-xr-x 2 ftpuser       ftpgroup      4096 2007-05-03 11:18 www.dinopsys.net

Dilerseniz user ekleme cikarma islemlerini makalenin basinda kurdugumuz PMA ile yapabilirsiniz.

Kolay gelsin.

 

 

 

Categories:

Tags:

No responses yet

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir