Kemarin ada seorang rekan bertanya caranya mengakses server Linuxnya melalui FTP. Katanya dia sudah coba akses FTP ke servernya (servernya menggunakan Ubuntu kalau tidak salah) tapi mendapat error "Connection refused"
. Tentu saja langkah pertama yang saya sarankan adalah memeriksa apakah FTP servernya sudah aktif. Apakah port 21 (default port FTP) sudah listen di servernya. Ternyata belum ada FTP server yang aktif.
Secara default Ubuntu tidak menyertakan FTP server dalam paket instalasinya. Wajar bila kita coba FTP ke Ubuntu server akan mendapat gagal dengan pesan "Connection refused"
:
ttirtawi@macbook-air:~$ ftp 192.168.10.10 ftp: connect: Connection refused ftp> bye ttirtawi@macbook-air:~$
Untuk dapat mengakses FTP di Ubuntu, kita perlu menginstal paket FTP server terlebih dulu. Saya biasanya memilih vsftpd
untuk keperluan ini.
ttirtawi@gbt733:~$ sudo apt-get install vsftpd [sudo] password for ttirtawi: Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: vsftpd 0 upgraded, 1 newly installed, 0 to remove and 256 not upgraded. Need to get 0 B/132 kB of archives. After this operation, 364 kB of additional disk space will be used. Preconfiguring packages ... Selecting previously unselected package vsftpd. (Reading database ... 190272 files and directories currently installed.) Unpacking vsftpd (from .../vsftpd_2.3.5-3ubuntu1_i386.deb) ... Processing triggers for man-db ... Processing triggers for ureadahead ... Setting up vsftpd (2.3.5-3ubuntu1) ... vsftpd start/running, process 7570 Processing triggers for ureadahead ... ttirtawi@gbt733:~$
Setelah paket vsftpd
terinstal, aplikasi vsftpd
akan otomatis bekerja dan menunggu di port 21 :
ttirtawi@gbt733:~$ netstat -ano | grep :21 tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN off (0.00/0/0) ttirtawi@gbt733:~$
Setelah itu kita bisa akses servernya via FTP :
ttirtawi@macbook-air:~$ ftp 192.168.10.10 Connected to 192.168.10.10. 220 (vsFTPd 2.3.5) 530 Please login with USER and PASS. Name (192.168.10.10:ttirtawi): ttirtawi 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp>
Tapi kita belum bisa login ke FTP server sebagai user root
:
ttirtawi@macbook-air:~$ ftp 192.168.10.10 Connected to 192.168.10.10. 220 (vsFTPd 2.3.5) 530 Please login with USER and PASS. Name (192.168.10.10:ttirtawi): root 331 Please specify the password. Password: 530 Login incorrect. Login failed. ftp>
Meskipun kita sudah login & memasukkan password root
yang benar, kita tetap tidak bisa otomatis login sebagai root
. Akan selalu muncul pesan error Login incorrect
seperti contoh di atas. Secara default, root
tidak diperkenankan mengakses FTP server. File /etc/ftpusers
mengatur daftar user yang tidak boleh login ke FTP server, termasuk root
.
ttirtawi@gbt733:~$ cat /etc/ftpusers # /etc/ftpusers: list of users disallowed FTP access. See ftpusers(5). # root ###### Hapus baris ini atau beri tanda # di awal baris daemon bin sys sync games man lp mail news uucp nobody ttirtawi@gbt733:~$
Dengan menghapus user root
dari dalam file /etc/ftpusers
atau cukup menambahkan tanda #
di depan user root
, maka root
bisa mengakses FTP server.
ttirtawi@macbook-air:~$ ftp 192.168.10.10 Connected to 192.168.10.10. 220 (vsFTPd 2.3.5) 530 Please login with USER and PASS. Name (192.168.10.10:ttirtawi): root 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp>
masih gak mau.. gimana dong