• Tidak ada hasil yang ditemukan

Membangun Server FTP menggunakan VSFTPD pada Linux CentOS 5.3

N/A
N/A
Protected

Academic year: 2021

Membagikan "Membangun Server FTP menggunakan VSFTPD pada Linux CentOS 5.3"

Copied!
12
0
0

Teks penuh

(1)

 

Membangun Server FTP menggunakan VSFTPD pada Linux CentOS 5.3 

Oleh I Putu Hariyadi, S.Kom, CCNA 

[email protected]

 

  Langkah‐langkah instalasi & konfigurasi VSFTPD  1. Memverifikasi paket aplikasi vsftpd telah terinstall atau belum:  [root@arjuna ~]# rpm -qa | grep vsftpd [root@arjuna ~]#

 

2. Instalasi paket aplikasi vsftpd: 

[root@arjuna ~]# rpm -ivh vsftpd-2.0.5-12.el5.i386.rpm

warning: vsftpd-2.0.5-12.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897

Preparing... ########################################### [100%] 1:vsftpd ########################################### [100%]   3. Memverifikasi instalasi paket aplikasi vsftpd: 

[root@arjuna ~]# rpm -qa | grep vsftpd vsftpd-2.0.5-12.el5

[root@arjuna ~]#  

(2)

  [root@arjuna ~]# service vsftpd status

vsftpd is stopped  

5. Mengaktifkan service vsftpd: 

[root@arjuna ~]# service vsftpd start

Starting vsftpd for vsftpd: [ OK ]  

6. Memverifikasi status service vsftpd: 

[root@arjuna ~]# service vsftpd status vsftpd (pid 6356) is running... [root@arjuna ~]#   7. Uji coba layanan Server FTP melalui localhost  [root@arjuna ~]# ftp localhost Connected to arjuna.stmikbumigora.intra.net. 220 (vsFTPd 2.0.5)

530 Please login with USER and PASS. 530 Please login with USER and PASS.

KERBEROS_V4 rejected as an authentication type Name (localhost:root): anonymous

331 Please specify the password. Password:

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files. ftp> ls

227 Entering Passive Mode (127,0,0,1,221,18) 150 Here comes the directory listing.

drwxr-xr-x 2 0 0 4096 May 24 2008 pub 226 Directory send OK.

(3)

  221 Goodbye. [root@arjuna ~]#   8. Konfigurasi file vsftpd.conf:  • Berpindah ke lokasi direktori penyimpanan file konfigurasi menggunakan perintah “cd”:  [root@arjuna ~]# cd /etc/vsftpd/ • Menampilkan isi direktori menggunakan perintah “ls”:  [root@arjuna vsftpd]# ls

ftpusers user_list vsftpd.conf vsftpd_conf_migrate.sh • Membackup file konfigurasi vsftpd.conf menggunakan perintah “cp”: 

[root@arjuna vsftpd]# cp vsftpd.conf vsftpd.conf.backup  

• Mengubah konfigurasi file vsftpd.conf menggunakan editor “nano”:  [root@arjuna vsftpd]# nano vsftpd.conf

# Example config file /etc/vsftpd/vsftpd.conf #

# The default compiled in settings are fairly paranoid. This sample file # loosens things up a bit, to make the ftp daemon more usable.

# Please see vsftpd.conf.5 for all compiled in defaults. #

# READ THIS: This example file is NOT an exhaustive list of vsftpd options. # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's # capabilities.

#

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).

# Mengijinkan anonymous FTP anonymous_enable=YES

#

# Uncomment this to allow local users to log in.

# Mengijinkan user local Linux untuk login melalui FTP local_enable=YES

#

# Uncomment this to enable any form of FTP write command. write_enable=YES

#

# Default umask for local users is 077. You may wish to change this to 022, # if your users expect that (022 is used by most other ftpd's)

# Mengatur default ijin akses local_umask=022

#

# Uncomment this to allow the anonymous FTP user to upload files. This only # has an effect if the above global write enable is activated. Also, you will # obviously need to create a directory writable by the FTP user.

# Digunakan untuk mengijinkan user anonymous untuk mengupload file ke Server FTP

#anon_upload_enable=YES #

(4)

  # Uncomment this if you want the anonymous FTP user to be able to create # new directories.

# Digunakan untuk mengijinkan user anonymous untuk membuat direktori di Server FTP

#anon_mkdir_write_enable=YES #

# Activate directory messages - messages given to remote users when they # go into a certain directory.

# Digunakan untuk menampilkan pesan direktori kepada pengguna remote ketika masuk ke dalam direktori tertentu.

dirmessage_enable=YES #

# Activate logging of uploads/downloads.

# Mengaktifkan log untuk aktivitas upload dan download

xferlog_enable=YES #

# Make sure PORT transfer connections originate from port 20 (ftp-data).

# Memastikan agar port yang digunakan untuk koneksi transfer data berasal dari port 20

connect_from_port_20=YES #

# If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not

# recommended!

# Mengatur kepemilikan file yang diupload oleh user anonymous #chown_uploads=YES

#chown_username=whoever #

# You may override where the log file goes if you like. The default is shown # below.

# Mengatur lokasi penyimpanan file log Server FTP xferlog_file=/var/log/vsftpd.log

#

# If you want, you can have your log file in standard ftpd xferlog format

# Mengatur format log Server FTP xferlog_std_format=YES

#

# You may change the default value for timing out an idle session.

# Mengatur timeout untuk sesi pengguna FTP yang idle, defaultnya 300 detik #idle_session_timeout=600

#

# You may change the default value for timing out a data connection.

# Mengatur timeout untuk koneksi data, defaultnya 300 detik #data_connection_timeout=120

#

# It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user.

# Mendefinisikan user yang unik dimana server FTP dapat menggunakannya # sebagai user yang terisolasi secara keseluruhan dan user yang tidak # memiliki privilege

#nopriv_user=ftpsecure #

# Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients.

(5)

 

#async_abor_enable=YES #

# By default the server will pretend to allow ASCII mode but in fact ignore # the request. Turn on the below options to have the server actually do ASCII # mangling on files when in ASCII mode.

# Beware that on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd

# predicted this attack and has always been safe, reporting the size of the # raw file.

# ASCII mangling is a horrible feature of the protocol. #

# Secara default server akan berpura-pura untuk mengijinkan mode ASCII tetapi # pada kenyataannya mengabaikan permintaannya. Aktifkan parameter berikut # agar server FTP melakukan ASCII mangling pada file-file dalam mode ASCII # Hati-hati, pada beberapa server FTP, dukungan ASCII memungkinkan terjadinya # Denial of Service Attack (DoS)

# ASCII mangling merupakan fitur yang mengerikan dari protocol #ascii_upload_enable=YES

#ascii_download_enable=YES #

# You may fully customise the login banner string:

# Mengatur pesan login ke Server FTP

ftpd_banner=Selamat Datang di Server FTP Hotspot STMIK Bumigora Mataram. #

# You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks.

# Mengatur alamat-alamat email yang tidak diijinkan sebagai alamat email # anonymous

#deny_email_enable=YES # (default follows)

#banned_email_file=/etc/vsftpd/banned_emails #

# You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot().

# Menentukan user-user local ke mode chroot pada masing-masing home direktori # mereka. Chroot bertujuan untuk menjalankan perintah atau shell interactive # dengan root directory special

#chroot_list_enable=YES # (default follows)

#chroot_list_file=/etc/vsftpd/chroot_list #

# You may activate the "-R" option to the builtin ls. This is disabled by # default to avoid remote users being able to cause excessive I/O on large # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume # the presence of the "-R" option, so there is a strong case for enabling it.

# Mengaktifkan fitur recursive pada perintah ls #ls_recurse_enable=YES

#

# When "listen" directive is enabled, vsftpd runs in standalone mode and # listens on IPv4 sockets. This directive cannot be used in conjunction # with the listen_ipv6 directive.

# Mengaktifkan FTP untuk socket IPv4 listen=YES

(6)

  # This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6

# sockets, you must run two copies of vsftpd whith two configuration files. # Make sure, that one of the listen options is commented !!

# Mengaktifkan FTP untuk socket IPv6 #listen_ipv6=YES

# Pluggable Authentication Module (PAM) digunakan untu mengatur

# library-library dari system yang digunakan untuk mengatur otentikasi pam_service_name=vsftpd

# Mengatur daftar user-user yang ditentukan oleh parameter userlist_file, # dimana jika user tersebut mencoba melakukan login akan ditolak sebelum # ditanya password.

userlist_enable=YES

# TCP Wrappers digunakan untuk memonitor dan memfilter permintaan yang masuk # untuk layanan-layanan jaringan seperti SYSTAT, FINGER, FTP, TELNET, RLOGIN, # RSH, EXEC, TFTP, TALK.

tcp_wrappers=YES

9. Me‐restart service ftpd: 

[root@arjuna ~]# service vsftpd restart Shutting down vsftpd:      [  OK  ] 

Starting vsftpd for vsftpd:      [  OK  ]   

10. Memverifikasi status service vsftpd: 

[root@arjuna ~]# service vsftpd status vsftpd (pid 16998) is running...  [root@arjuna ~]#    STUDI KASUS  Studi Kasus I: Membuat User Lokal di Linux untuk digunakan sebagai Login User pada Server FTP  Langkah‐langkah membuat user lokal sebagai login user pada Server FTP:  1. Membuat user lokal di Linux menggunakan perintah “useradd namauser”:  [root@arjuna ~]# useradd ngoprek

2. Mengatur password untuk user lokal yang dibuat pada langkah sebelumnya menggunakan  perintah “passwd namauser”: 

[root@arjuna ~]# passwd ngoprek Changing password for user ngoprek.

(7)

  New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully.   3. Berpindah user dari user “root” ke user yang baru dibuat menggunakan perintah “su ‐“:  [root@arjuna ~]# su – ngoprek 4. Menampilkan informasi saat ini login sebagai user siapa menggunakan perintah “whoami”:  [ngoprek@arjuna ~]$ whoami ngoprek    5. Menampilkan informasi lokasi directory dimana saat ini berada menggunakan perintah “pwd”:  [ngoprek@arjuna ~]$ pwd /home/ngoprek    6. Membuat file teks menggunakan editor “nano”:  [ngoprek@arjuna ~]$ nano dokumen.txt

    7. Menampilkan isi dari direktori dimana saat ini berada menggunakan perintah “ls”:   [ngoprek@arjuna ~]$ ls dokumen.txt    8. Menampilkan isi dari file teks yang dibuat pada langkah sebelumnya menggunakan perintah  “cat”: 

[ngoprek@arjuna ~]$ cat dokumen.txt Ini file buatan user ngoprek bro!!! 

(8)

    9. Keluar dari user “ngoprek” menggunakan perintah “exit”:  [ngoprek@arjuna ~]$ exit Logout 10. Uji coba layanan FTP menggunakan login user local Linux:  C:\>ftp 172.16.249.3 Connected to 172.16.249.3. 220 (vsFTPd 2.0.5)

User (172.16.249.3:(none)): ngoprek 331 Please specify the password. Password:

500 OOPS: cannot change directory:/home/ngoprek Connection closed by remote host.

 

Studi Kasus II: Mengaktifkan Parameter ftp_home_dir pada SELinux 

Langkah‐langkah untuk mengaktifkan parameter ftp_home_dir pada SELinux agar user yang login  melalui FTP dapat mengakses home directorynya masing‐masing: 

1. Menampilkan konfigurasi parameter ftp_home_dir menggunakan perintah “getsebool”:  [root@arjuna ~]# getsebool -a | grep ftp_home_dir 

ftp_home_dir ‐‐> off    2. Mengaktifkan konfigurasi parameter ftp_home_dir menggunakan perintah “setsebool”:  [root@arjuna ~]# setsebool ‐P ftp_home_dir=on    3. Memverifikasi konfigurasi parameter ftp_home_dir menggunakan perintah “getsebool”:  [root@arjuna ~]# getsebool -a | grep ftp_home_dir

ftp_home_dir ‐‐> on   

(9)

  4. Uji coba layanan FTP menggunakan login user local Linux yang telah dibuat pada studi kasus  sebelumnya:  C:\>ftp 172.16.249.3 Connected to 172.16.249.3. 220 (vsFTPd 2.0.5)

User (172.16.249.3:(none)): ngoprek 331 Please specify the password. Password:

230 Login successful. ftp> ls

200 PORT command successful. Consider using PASV. 150 Here comes the directory listing.

dokumen.txt

226 Directory send OK.

ftp: 14 bytes received in 0.02Seconds 0.88Kbytes/sec. ftp> quit   Studi Kasus III: Menonaktifkan Anonymous FTP  Langkah‐langkah menonaktifkan anonymous FTP:  1. Mengubah parameter anonymous_enable=YES menjadi anonymous_enable=NO pada file  konfigurasi vsftpd.conf di direktori /etc/vsftpd menggunakan editor “nano”: 

[root@arjuna vsftpd]# nano vsftpd.conf 2. Me‐restart service vsftpd: 

[root@arjuna vsftpd]# service vsftpd restart

Shutting down vsftpd: [ OK ] Starting vsftpd for vsftpd: [ OK ]  

(10)

  3. Uji coba layanan FTP menggunakan login user anonymous 

C:\>ftp 172.16.249.3

Connected to 172.16.249.3. 220 (vsFTPd 2.0.5)

User (172.16.249.3:(none)): anonymous 331 Please specify the password. Password: 530 Login incorrect. Login failed. ftp> quit 221 Goodbye.   Studi Kasus IV: Membuat Group dari User‐user FTP dengan hak akses berbagi pakai sebuah direktori  Langkah‐langkah membuat group dari user‐user FTP dengan hak akses berbagi pakai sebuah direktori:  1. Membuat group menggunakan perintah “groupadd namagroup”:  [root@arjuna vsftpd]# groupadd akademik

2. Membuat homedirectory bagi group menggunakan perintah “mkdir namadirectory”:  [root@arjuna vsftpd]# mkdir /home/akademik

3. Mengatur ijin akses homedirectory menggunakan perintah “chmod”:  [root@arjuna vsftpd]# chmod 770 /home/akademik

4. Mengubah kepemilikan homedirectory menggunakan perintah “chown”: 

[root@arjuna vsftpd]# chown root:akademik /home/akademik  

5. Membuat user sebagai anggota dari group yang telah dibuat menggunakan perintah “useradd”:  [root@arjuna vsftpd]# useradd -g akademik -d /home/akademik luna [root@arjuna vsftpd]# useradd -g akademik -d /home/akademik maya [root@arjuna vsftpd]# useradd -g akademik -d /home/akademik siska

(11)

 

6. Mengatur password masing‐masing user menggunakan perintah “passwd”:  [root@arjuna vsftpd]# passwd luna

Changing password for user luna. New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully. [root@arjuna vsftpd]# passwd siska

Changing password for user siska. New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully. [root@arjuna vsftpd]# passwd maya

Changing password for user maya. New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully.   7. Berpindah user menggunakan perintah “su ‐“:  [root@arjuna vsftpd]# su - luna -bash-3.2$ pwd /home/akademik 8. Uji coba layanan FTP menggunakan login user yang dibuat pada langkah sebelumnya:  C:\>ftp 172.16.249.3 Connected to 172.16.249.3.

(12)

  220 (vsFTPd 2.0.5)

User (172.16.249.3:(none)): luna 331 Please specify the password. Password:

230 Login successful. ftp> ls

200 PORT command successful. Consider using PASV. 150 Here comes the directory listing.

luna.txt maya.txt siska.txt

226 Directory send OK.

ftp: 31 bytes received in 0.03Seconds 0.97Kbytes/sec. ftp> get maya.txt

200 PORT command successful. Consider using PASV.

150 Opening BINARY mode data connection for maya.txt (31 bytes). 226 File send OK.

ftp: 31 bytes received in 0.00Seconds 31000.00Kbytes/sec. ftp> quit

Referensi

Dokumen terkait

Selain menyediakan layanan streaming , server ini juga digunakan untuk memanajemen segala aktivitas multimedia streaming termasuk manajemen user, file storage,

Proxy Server adalah sebuah komputer server atau program komputer yang dapat bertindak sebagai komputer lainnya untuk melakukan request terhadap content dari internet atau

Hal itulah yang membuat penulis akan mengangkat penelitian yang berkenaan dengan perancangan file server berbasis LDAP dan Samba PDC untuk memperbaiki sistem

Dalam perkembangannya, cloud computing berdasarkan tipenya dibagi menjadi tiga tipe, yaitu public cloud yang merupakan tipe yang mengijinkan pengguna untuk

Penerapan mail client berbasis web untuk memudahkan user dalam mengakses pesan yang dikirimkan untuknya, mensyaratkan adanya WEB MAIL server yang menangani proses

Sebuah proxy cache dapat dikonfigurasikan untuk berjalan standalone server atau sebagai hierarki cache dengan dengan proxy-proxy lainnya, yang akan kita bahas

Web server disini dapat melakukan operasi show information untuk memberikan informasi file yang ada kepada user, operasi Upload File untuk mengunggah file ke

Langkah Langkah Setting Ip Ketikkan perintah berikut untuk membuka file interfaces, gunakan perintah sudo jika anda tidak menggunakan user root: nano /etc/network/interfaces Kemudian