NUBSolutions

Just another WordPress.com weblog

Membuat ftp Server

Posted by nubsolutions on December 9, 2009

1. Download vsftpd-2.0.5-21.fc8.i386.rpm
2. Jalankan

[root@rt source]# rpm -ivh vsftpd-2.0.5-21.fc8.i386.rpm
warning: vsftpd-2.0.5-21.fc8.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6df2196f
Preparing… ########################################### [100%]
1:vsftpd ########################################### [100%]
[root@rt source]#

3. Untuk aktifasi satu persatu
[root@rt source]# /etc/init.d/vsftpd status
vsftpd is stopped
[root@rt source]#

[root@bigboy tmp]# /etc/init.d/vsftpd start
[root@bigboy tmp]# /etc/init.d/vsftpd stop
[root@bigboy tmp]# /etc/init.d/vsftpd restart

[root@rt source]# /etc/init.d/vsftpd status
vsftpd (pid 4786) is running…
[root@rt source]#

4. Agar selalu diaktifkan setelah boot
[root@rt source]#
[root@rt source]# chkconfig vsftpd on

5. Untuk check apakah process running atau tidak.

[root@rt source]# netstat -a | grep ftp
getnameinfo failed
getnameinfo failed
tcp 0 0 *:ftp *:* LISTEN
[root@rt source]#

6. Secara default ftp kita sudah aktif, sehingga jika di test dari client maka dengan
user anonymous maka sudah bisa masuk

C:\>ftp 192.168.140.128
Connected to 192.168.140.128.
220 (vsFTPd 2.0.5)
User (192.168.140.128:(none)): anonymous
331 Please specify the password.
Password:
230 Login successful.
ftp>

7. vsftpd.conf merupakan konfigurasi dari ftp server ini, dan terletak di direktory /etc/vsftpd

buang tanda mark ‘#’ untuk aktifasi beberapa perintah, contohnya

anon_upload_enable=YES
anon_mkdir_write_enable=YES

[root@rt vsftpd]# /etc/init.d/vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]

agar bisa lakukan upload data untuk user anonymous maka masukan perintah berikut

[root@rt pub]# mkdir /var/ftp/pub/upload
[root@rt pub]# ls -la
total 12
drwxr-xr-x 3 root root 4096 2009-08-20 07:54 .
drwxr-xr-x 3 root root 4096 2009-08-20 00:20 ..
drwxr-xr-x 2 root root 4096 2009-08-20 07:54 upload
[root@rt pub]# chmod 722 /var/ftp/pub/upload/
[root@rt pub]# ls -la
total 12
drwxr-xr-x 3 root root 4096 2009-08-20 07:54 .
drwxr-xr-x 3 root root 4096 2009-08-20 00:20 ..
drwx-w–w- 2 root root 4096 2009-08-20 07:54 upload
[root@rt pub]#

chmod 722, agar tidak bisa diakses oleh user yg lain.

8. Untuk menambahkan user account, yaitu pada direktory /etc/vsftpd/ftpusers

Berikut ini contoh kasus untuk group user akunting dengan fungsi anonymous dimatikan

anonymous_enable=NO
local_enable=YES
[root@rt vsftpd]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]

[root@rt vsftpd]# groupadd akunting
[root@rt vsftpd]# mkdir /home/dataakunting
[root@rt home]# ls /home/ -la
total 28
drwxr-xr-x 4 root root 4096 2009-08-20 08:13 .
drwxr-xr-x 23 root root 4096 2009-08-19 22:15 ..
drwxr-xr-x 2 root root 4096 2009-08-20 08:13 dataakunting

Agar group akunting saja yg bisa upload & download maka

[root@rt home]# chmod 750 /home/dataakunting/
[root@rt home]# ls /home/ -la
total 28
drwxr-xr-x 4 root root 4096 2009-08-20 08:13 .
drwxr-xr-x 23 root root 4096 2009-08-19 22:15 ..
drwxr-x— 2 root root 4096 2009-08-20 08:13 dataakunting

[root@rt home]# chown root:akunting /home/dataakunting/

Note: Ganti chmod agar bisa tulis (contohnya menjadi 775)

tambahkan user dengan default direktori /home/dataakunting
[root@rt home]# useradd -g akunting -d /home/dataakunting/ bob
[root@rt home]# useradd -g akunting -d /home/dataakunting john
[root@rt home]# passwd bob
[root@rt home]# passwd john

Test dari Client
C:\>ftp 192.168.140.128
Connected to 192.168.140.128.
220 Welcome to blah FTP service(vsFTPD 2.0.5)
User (192.168.140.128:(none)): bob
331 Please specify the password.
Password:
230 Login successful.
ftp> bin
200 Switching to Binary mode.
ftp> hash
Hash mark printing On ftp: (2048 bytes/hash mark) .
ftp> prompt
Interactive mode Off .
ftp> put coba.txt
200 PORT command successful. Consider using PASV.
150 Ok to send data.

226 File receive OK.
ftp: 8 bytes sent in 0.00Seconds 8000.00Kbytes/sec.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
coba.txt

226 Directory send OK.
ftp: 10 bytes received in 0.00Seconds 10000.00Kbytes/sec.
ftp> ls -la
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxrwxr-x 2 0 501 4096 Aug 20 01:28 .
drwxr-xr-x 4 0 0 4096 Aug 20 01:13 ..
-rw-r–r– 1 501 501 8 Aug 20 01:28 coba.txt

226 Directory send OK.
ftp: 185 bytes received in 0.00Seconds 185000.00Kbytes/sec.
ftp>

Sorry, the comment form is closed at this time.

 
%d bloggers like this: