Konfigurasi FTP Server di Ubuntu 7.10
December 8th, 2008
Goto comments Leave a comment
FTP (singkatan dari File Transfer Protocol) adalah sebuah protokol Internet yang berjalan di dalam lapisan aplikasi yang merupakan standar untuk pentransferan berkas (file) komputer antar mesin-mesin dalam sebuah internetwork.
FTP merupakan salah satu protokol Internet yang paling awal dikembangkan, dan masih digunakan hingga saat ini untuk melakukan pengunduhan (download) dan penggugahan (upload) berkas-berkas komputer antara klien FTP dan server FTP. Sebuah Klien FTP merupakan aplikasi yang dapat mengeluarkan perintah-perintah FTP ke sebuah server FTP, sementara server FTP adalah sebuah Windows Service atau daemon yang berjalan di atas sebuah komputer yang merespons perintah-perintah dari sebuah klien FTP. Perintah-perintah FTP dapat digunakan untuk mengubah direktori, mengubah modus transfer antara biner dan ASCII, menggugah berkas komputer ke server FTP, serta mengunduh berkas dari server FTP.
Sebuah server FTP diakses dengan menggunakan Universal Resource Identifier (URI) dengan menggunakan format ftp://namaserver. Klien FTP dapat menghubungi server FTP dengan membuka URI tersebut.
(Sumber : http://id.wikipedia.org/wiki/FTP)
Langkah-langkah konfigurasi FTP Server (proftpd) di Ubuntu Gutsy Gibbon :
1. Download dan install program proftpd untuk FTP Server.
#apt-get install proftpd
Reading package lists… Done
Building dependency tree
Reading state information… Done
Suggested packages:
proftpd-doc
The following NEW packages will be installed:
proftpd
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 784kB of archives.
After unpacking 2331kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com feisty/universe proftpd 1.3.0-21ubuntu1 [784kB]
Fetched 784kB in 14s (54.1kB/s)
Preconfiguring packages …
Selecting previously deselected package proftpd.
(Reading database … 155004 files and directories currently installed.)
Unpacking proftpd (from …/proftpd_1.3.0-21ubuntu1_i386.deb) …
Setting up proftpd (1.3.0-21ubuntu1) …
——— IMPORTANT INFORMATION FOR XINETD USERS ———-
The following line will be added to your /etc/inetd.conf file:
ftp stream tcp nowait root /usr/sbin/tcpd /usr/sbin/proftpd
If you are indeed using xinetd, you will have to convert the
above into /etc/xinetd.conf format, and add it manually. See
/usr/share/doc/xinetd/README.Debian for more information.
———————————————————–
Adding system user `proftpd’ (UID 118) …
Adding new user `proftpd’ (UID 118) with group `nogroup’ …
Not creating home directory `/var/run/proftpd’.
Adding system user `ftp’ (UID 119) …
Adding new user `ftp’ (UID 119) with group `nogroup’ …
Creating home directory `/home/ftp’ …
`/usr/share/proftpd/templates/welcome.msg’ -> `/home/ftp/welcome.msg.proftpd-new’
ProFTPd warning: cannot start neither in standalone nor in inetd/xinetd mode. Check your configuration.
Coba jalankan proftpd.
#/etc/init.d/proftpd start
Password:
ProFTPd warning: cannot start neither in standalone nor in inetd/xinetd mode. Check your configuration.
2. Jika tidak ada repositori lokal, maka bisa dilakukan secara manual yaitu dengan menginstall file-file dependensi yang dibutuhkan. Install program proftpd (proftpd_1.3.0-24ubuntu1_i386.deb).
root@komputer02-desktop:/# dpkg -i proftpd_1.3.0-24ubuntu1_i386.deb
(Reading database ... 89245 files and directories currently installed.)
Preparing to replace proftpd 1.3.0-24ubuntu1 (using proftpd_1.3.0-24ubuntu1_i386.deb) ...
Unpacking replacement proftpd ...
dpkg: dependency problems prevent configuration of proftpd:
proftpd depends on libmysqlclient15off (>= 5.0.27-1); however:
Package libmysqlclient15off is not installed.
proftpd depends on libpq5; however:
Package libpq5 is not installed.
dpkg: error processing proftpd (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
proftpd
Dari pesan di atas bisa dilihat bahwa instalasi proftpd masih membutuhkan file dependensi: libmysqlclient15off dan libpq5.
Install dulu file dependensi dengan menggunakan perintah: dpkg -i namafile.deb
Jika sudah, coba install lagi proftpd (proftpd_1.3.0-24ubuntu1_i386.deb)
root@komputer02-desktop:/# dpkg -i libmysqlclient15off_5.0.45-1ubuntu3.4_i386.deb
(Reading database ... 89098 files and directories currently installed.)
Preparing to replace libmysqlclient15off 5.0.45-1ubuntu3.4 (using libmysqlclient15off_5.0.45-1ubuntu3.4_i386.deb) ...
Unpacking replacement libmysqlclient15off ...
Setting up libmysqlclient15off (5.0.45-1ubuntu3.4) ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
Begitu juga dengan file libpq5 dilanjutkan dengan install proftpd.
root@komputer02-desktop:/# dpkg -i proftpd_1.3.0-24ubuntu1_i386.deb
(Reading database ... 89098 files and directories currently installed.)
Preparing to replace proftpd 1.3.0-24ubuntu1 (using proftpd_1.3.0-24ubuntu1_i386.deb) ...
Unpacking replacement proftpd ...
Setting up proftpd (1.3.0-24ubuntu1) ...
Adding system user `proftpd' (UID 109) ...
Adding new user `proftpd' (UID 109) with group `nogroup' ...
Not creating home directory `/var/run/proftpd'.
Adding system user `ftp' (UID 110) ...
Adding new user `ftp' (UID 110) with group `nogroup' ...
Creating home directory `/home/ftp' ...
`/usr/share/proftpd/templates/welcome.msg' -> `/home/ftp/welcome.msg.proftpd-new'
* Starting ftp server proftpd - IPv6 getaddrinfo 'komputer02-desktop'
error: No address associated with hostname [ OK ]
3. Pilih standalone.
4. Membuat direktori
root@komputer02-desktop:/home# mkdir ftp_shared
root@komputer02-desktop:/home# cd ftp_shared/; mkdir upload download
Set security permission
root@komputer02-desktop:/home/ftp_shared# cd ..
root@komputer02-desktop:/home# sudo chmod 755 ftp_shared/
root@komputer02-desktop:/home# cd ftp_shared/
root@komputer02-desktop:/home/ftp_shared# sudo chmod 755 download/
root@komputer02-desktop:/home/ftp_shared# sudo chmod 777 upload/
5. Membuat user baru untuk FTP
Melalui menu System > Administration > Users and Groups kemudian klik Add user.
misalkan kita menambah user: wiwin, dengan folder homenya: /home/ftp_shared
6. Mengkonfigurasi proftpd server
Langkah akhir adalah mengkonfigurasikan proftpd. File konfigurasi proftpd berada di /etc/proftpd/proftpd.conf.
Sebelumnya backup dulu file proftpd.conf dan selanjutnya edit file tersebut.
root@komputer02-desktop:/etc/proftpd# cp proftpd.conf proftpd.conf.asli
root@komputer02-desktop:/etc/proftpd# pico proftpd.conf
#
# /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
# To really apply changes reload proftpd after modifications.
#
# Includes DSO modules
Include /etc/proftpd/modules.conf
# Set off to disable IPv6 support which is annoying on IPv4 only boxes.
UseIPv6 off
ServerName "Debian"
ServerType standalone
DeferWelcome off
MultilineRFC2228 on
DefaultServer on
ShowSymlinks on
TimeoutNoTransfer 600
TimeoutStalled 600
TimeoutIdle 1200
DisplayLogin welcome.msg
DisplayFirstChdir .message
ListOptions "-l"
DenyFilter \*.*/
# Use this to jail all users in their homes
# DefaultRoot ~
# Users require a valid shell listed in /etc/shells to login.
# Use this directive to release that constrain.
# RequireValidShell off
# Port 21 is the standard FTP port.
Port 2008
# In some cases you have to specify passive ports range to by-pass
# firewall limitations. Ephemeral ports can be used for that, but
# feel free to use a more narrow range.
# PassivePorts 49152 65534
# If your host was NATted, this option is useful in order to
# allow passive tranfers to work. You have to use your public
# address and opening the passive ports used on your firewall as well.
# MasqueradeAddress 1.2.3.4
# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances 30
# Set the user and group that the server normally runs at.
User wiwin
Group nogroup
# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask 022 022
# Normally, we want files to be overwriteable.
AllowOverwrite on
# Uncomment this if you are using NIS or LDAP to retrieve passwords:
# PersistentPasswd off
# Be warned: use of this directive impacts CPU average load!
# Uncomment this if you like to see progress and transfer rate with ftpwho
# in downloads. That is not needed for uploads rates.
#
# UseSendFile off
# Choose a SQL backend among MySQL or PostgreSQL.
# Both modules are loaded in default configuration, so you have to specify the backend
# or comment out the unused module in /etc/proftpd/modules.conf.
# Use 'mysql' or 'postgres' as possible values.
#
#
# SQLBackend mysql
#
TransferLog /var/log/proftpd/xferlog
SystemLog /var/log/proftpd/proftpd.log
<IfModule mod_tls.c>
TLSEngine off
</IfModule>
<IfModule mod_quota.c>
QuotaEngine on
</IfModule>
<IfModule mod_ratio.c>
Ratios on
</IfModule>
# Delay engine reduces impact of the so-called Timing Attack described in
# http://security.lss.hr/index.php?page=details&ID=LSS-2004-10-02
# It is on by default.
<IfModule mod_delay.c>
DelayEngine on
</IfModule>
<IfModule mod_ctrls.c>
ControlsEngine on
ControlsMaxClients 2
ControlsLog /var/log/proftpd/controls.log
ControlsInterval 5
ControlsSocket /var/run/proftpd/proftpd.sock
</IfModule>
<IfModule mod_ctrls_admin.c>
AdminControlsEngine on
</IfModule>
# A basic anonymous configuration, no upload directories.
#
# User ftp
# Group nogroup
# # We want clients to be able to login with "anonymous" as well as "ftp"
# UserAlias anonymous ftp
# # Cosmetic changes, all files belongs to ftp user
# DirFakeUser on ftp
# DirFakeGroup on ftp
#
# RequireValidShell off
#
# # Limit the maximum number of anonymous logins
# MaxClients 10
#
# # We want 'welcome.msg' displayed at login, and '.message' displayed
# # in each newly chdired directory.
# DisplayLogin welcome.msg
# DisplayFirstChdir .message
#
# # Limit WRITE everywhere in the anonymous chroot
#
#
# DenyAll
#
#
<Directory /home/ftp_shared>
Umask 022 022
AllowOverwrite off
<Limit MKD STOR DELE XMKD RNRF RNTO RMD XRMD>
DenyAll
</Limit>
</Directory>
<Directory /home/ftp_shared/download/*>
Umask 022 022
AllowOverwrite off
<Limit MKD STOR DELE XMKD RNEF RNTO RMD XRMD>
DenyAll
</Limit>
</Directory>
<Directory /home/ftp_shared/upload/>
Umask 022 022
AllowOverwrite on
<Limit READ RMD DELE>
DenyAll
</Limit>
</Directory>
# # Uncomment this if you're brave.
# #
# # # Umask 022 is a good standard umask to prevent new files and dirs
# # # (second parm) from being group and world writable.
# # Umask 022 022
# #
# # DenyAll
# #
# #
# # AllowAll
# #
# #
#
#
7. Restart service proftpd
root@komputer02-desktop:/# /etc/init.d/proftpd restart
* Stopping ftp server proftpd [ OK ]
* Starting ftp server proftpd [ OK ]
8. Sampai di sini, konfigurasi proftpd selesai. Sekarang bisa dicoba upload file dari komputer lain ke komputer yang sudah kita setting sebelumnya. Untuk melakukan transfer file (upload, download) di windows bisa menggunakan program FileZilla atau program FTP lain.
Host – > masukkan hostname/IP komp tujuan (exp. 192.168.1.2)
Username – > masukkan username yang telah dibuat sebelumnya (wiwin)
Password – > Masukkan password dari username
Port – > Masukkan portnya (2008)
Untuk lebih jelasnya bisa dilihat gambar berikut.
9. Untuk melakukan upload dan download dari atau ke komputer tujuan bisa dilakukan dengan drag dan drop.
Sumber: http://ubuntulinux.or.id/blog/2008/07/18/ftp-server-pada-ubuntu/
Tulisan ini cuma tulisan seorang newbie yang hanya selalu ingin tahu dan ingin bisa serta, selalu ingin mencoba . Karena hanya sebuah catatan dan dokumentasi dari belajar serta bereferensi dari berbagai sumber, maka bahasa yang digunakan adalah bahasa yang sederhana dan biasa aja.
Ftp (File Transfer Protokol) adalah layanan atau protokol yang digunakan sehingga memungkinkan bisa bisa melakukan transfer file dengan penyedia Layanan Ftp /Ftp Server, dengan berbagai kebijakan yang diterapkan didalamnya(Ftp Server).
Langkah-langkah dalam membangun FTP Server
1.Instalasi Ftp Server (proftpd)
2.Konfigurasi Ftp Server (proftpd.conf)
Pemberian hak akses pada ftp dibagi menjadi 2 buah user:
1.Anonymous Ftp , Ftp server memberikan akses kepada siapapun tanpa harus mempunyai user account dan password.
2.User Ftp, hanya user yang mempunyai user account dan password saja yang bisa mengakses ke server ftp.
Untuk keamanan server maka kita akan mematikan eksekusi file binary (.bin) yang bisa berjalan pada shell kita, kita edit file /etc/shells:
$ sudo gedit /etc/shells
tambahkan baris ini dibawah baris berikutnya
/bin/false
Setelah dirasa sudah siap semuanya (komputer,repository dan jaringan) maka langsung aja kita mulai buat ftp servernya.
Install program ftp server (proftpd )
$ sudo apt-get install proftpd
setelah proses instalasi hampir selesai, nanti akan ada 2 pilihan ,kita pilih standalone saja. Jika tidak ada masalah dalam peginstalan kita lanjutkan ke langkah berikutnya.
Melakukan setting Ftp server dengan berbagai pilihan.
A. Mengkonfigurasi Ftp server supaya user seperti dipenjara “jailed” dalam mengakses direktory /home.Edit file konfigurasi Ftp Server yaitu file proftpd.conf yang berada dalam direktory /etc/proftpd/
$ sudo gedit /etc/proftpd/proftpd.conf
kemudian cari baris ini,
…
DenyFilter \*.*/
…
Tambahkan baris dibawah ini dibawahnya
DefaultRoot ~
Setelah itu simpan hasil editan, kemudian restart proftpd nya.
$ sudo /etc/init.d/proftpd restart
B. Mengkonfigurasi Ftp Server dengan user Anonymous dan opsinya Read Only/baca saja. Edit file proftpd.conf dan sisipkan baris berikut ini.
User ftp
Group nogroup
UserAlias anonymous ftp
DirFakeUser on ftp
DirFakeGroup on ftp
RequireValidShell off
MaxClients 10
DisplayLogin welcome.msg
DisplayFirstChdir .message
DenyAll
Simpan dan restart lagi proftpd-nya
C.) Mengkonfigurasi Ftp Server dengan user Anonymous dan opsinya Read and Write/baca dan tulis. Edit file proftpd.conf dan edit baris berikut ini.
User ftp
Group nogroup
UserAlias anonymous ftp
DirFakeUser on ftp
DirFakeGroup on ftp
RequireValidShell off
MaxClients 10
DisplayLogin welcome.msg
DisplayFirstChdir .message
DenyAll
Simpan hasil editan dan restart proftpd nya
D. Mengkonfigurasi Ftp Server dengan akses Ftp user.
Untuk melakukan setting Ftp dengan opsi ini perlu beberapa langkah yang harus dilakukan.
Membuat user dalam komputer yang sekalian nanti juga aka didaftarkan sebagai ftpuser.
$ sudo adduser namauser
Setelah nama user dibuat edit fiel proftpd.conf dan tambahkan baris berikut.
————> folder default untuk userftpnya
User namauser ————> nama untuk user yang kita daftarkan
Group nogroup
UserAlias anonymous ftp
DirFakeUser on ftp
DirFakeGroup on ftp
RequireValidShell off
MaxClients 10
DisplayLogin welcome.msg
DisplayFirstChdir .message
AllowAll
Dari script diatas maka kita bisa membatasi login ke ftpserver berdasarkan user yang telah kita daftarkan. Dengan berbagai opsi diatas maka kita dapat mensetting Ftp server sesuai dengan kebutuhan kita. Semoga dapat membantu.
A. Instalasi Linux Standard
Boot dari CD instalasi Ubuntu.
Untuk pembagian partisi :
Swap = 2 x RAM (contoh : untuk RAM 512MB maka Swap = 1024MB)
/ = 5GB (atau sesuaikan dengan keperluan)
/home = Space harddisk untuk data para user
B. Setting Network dan Tools Standard
Untuk setting network melalui terminal console :
$>sudo gedit /etc/network/interfaces
Contoh setting network :
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.111
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.134.2.5 202.134.0.155 203.130.196.5
# The secondary network interface
auto eth1
iface eth1 inet static
address 192.168.0.111
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.254
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.134.2.5 202.134.0.155
Sesudah di edit lalu di save dan ketikan :
$>sudo /etc/init.d/networking restart
Test koneksi dengan cara :
$>ping 192.168.1.11
Ubah dulu default source instalasi aplikasi online kita, dengan maksud supaya instalasi bisa lebih cepat karena menggunakan server-server lokal.
$>sudo gedit /etc/apt/sources.list
Tambahkan baris-baris berikut:
### sources.list.kambing (server di jaringan IIX)
### Repository dengan menggunakan server mirror kambing.ui.edu
### Untuk rilis lain selain feisty silakan ganti semua kata feisty
### dengan misalnya dapper atau edgy dsb
## REPOSITORY UTAMA
deb http://kambing.ui.edu/ubuntu gutsy main restricted universe multiverse
deb-src http://kambing.ui.edu/ubuntu gutsy main restricted universe multiverse
## INI UNTUK MAJOR BUG FIX UPDATES
deb http://kambing.ui.edu/ubuntu gutsy-updates main restricted universe multiverse
deb-src http://kambing.ui.edu/ubuntu gutsy-updates main restricted universe multiverse
## INI UNTUK UBUNTU SECURITY UPDATES
deb http://kambing.ui.edu/ubuntu gutsy-security main restricted universe multiverse
deb-src http://kambing.ui.edu/ubuntu gutsy-security main restricted universe multiverse
## COMPIZ FUSION a.k.a BLINK BLINK
deb http://ppa.dogfood.launchpad.net/amaranth/ubuntu feisty main restricted universe multiverse
deb-src http://ppa.dogfood.launchpad.net/amaranth/ubuntu feisty main restricted universe multiverse
Atau:
### sources.list.foss-id.Depkominfo
### Repository dengan menggunakan server mirror foss-id (server di jaringan TELKOM)
### Untuk rilis lain selain feisty silakan ganti semua kata feisty
### dengan misalnya dapper atau edgy dsb
## REPOSITORI UTAMA
deb http://dl2.foss-id.web.id/ubuntu feisty main restricted universe multiverse
deb-src http://dl2.foss-id.web.id/ubuntu feisty main restricted universe multiverse
## INI UNTUK MAJOR BUG FIX UPDATES
deb http://dl2.foss-id.web.id/ubuntu feisty-updates main restricted universe multiverse
deb-src http://dl2.foss-id.web.id/ubuntu feisty-updates main restricted universe multiverse
## INI UNTUK UBUNTU SECURITY UPDATES
deb http://dl2.foss-id.web.id/ubuntu feisty-security main restricted universe multiverse
deb-src http://dl2.foss-id.web.id/ubuntu feisty-security main restricted universe multiverse
## COMPIZ FUSION a.k.a BLINK BLINK
deb http://ppa.dogfood.launchpad.net/amaranth/ubuntu feisty main restricted universe multiverse
deb-src http://ppa.dogfood.launchpad.net/amaranth/ubuntu feisty main restricted universe multiverse
Sesudah di save, lalu ketikan
$>sudo apt-get update
Setelah itu install mc, yaitu tools serbaguna untuk editor, filemanager, ftp client dll.
$>sudo apt-get install mc
Untuk instalasi berbagai macam tools compiler dan library teknis penting
$>sudo apt-get install build-essential
Utiliti untuk kompress atau unkompress file :
$>sudo apt-get install unrar unzip
Untuk pengganti hyperterminal di linux, siapa tahu perlu mengeset modem atau router :
$>sudo apt-get install minicom
C. Server / Layanan
C.1. SSH Server
Instalasi ssh server, uagar server kita bisa diakses secara remote dari komputer lain:
$>sudo apt-get install ssh
C.2. LAMP
Jika kita bicara tentang web server, di dunia opensource dan linux umumnya banyak digunakan platform LAMP (Linux, Apache, MySQL dan PHP). Pada LAMP, web server Apache dilengkapi interpreter server side scripting PHP dan database server MySQL, menjadi suatu platform pengembangan dan deployment web yang banyak digunakan oleh developer web.
Instalasi web server Apache dan PHP5:
$>sudo apt-get install apache2 php5 php5-gd php-pear
Instalasi database server MySQL:
$> sudo apt-get install mysql-server phpmyadmin
Jika dirasa perlu nyalakan modul-modul apache:
$> sudo a2enmod rewrite
$> sudo /etc/init.d/apache2 restart
C.3. Ruby dan Ruby on Rails
Ruby adalah bahasa pemrograman berorientasi obyek dan Ruby on Rails adalah framework pengembangan web yang menggunakan bahasa Ruby. Karena kemudahan dan banyak kelebihannya Ruby on Rails kini makin populer di dunia web development.
Instalasi kelengkapan standar Ruby:
$> sudo apt-get install ruby-full rubygems libruby libruby-extras ruby1.8-dev libmysql-ruby rails
Mengupdate Rubygem:
$> sudo gem update
$> sudo gem update –system
C.4. FTP Server
Untuk memungkinkan user mengaupload file ke server kita dapat menginstal FTP server:
$> sudo apt-get install vsftpd
Pastikan beberapa konfigurasi di bawah ini:
anonymous_enable=NO
local_enable=YES
write_enable=YES
Setelah mengedit file konfigurasi, restart FTP server:
$> sudo gedit /etc/vsftpd.conf
$> sudo /etc/init.d/vsftpd start
C.5. Remote Desktop Server
Terkadang server kita perlu diakses juga GUI-nya dari jauh menggunakan remote desktop untuk keperluan tertentu (menjalankan Wireshark di server misalnya). Disini kita akan menggunakan x11vnc server yang memiliki beberapa kelebihan dibanding fitur remote desktop bawaan Ubuntu.
Menginstall x11vnc dan membuat script pemanggil:
$> sudo apt-get install x11vnc vnc-common
$> vncpasswd ~/.vnc/passwd
$> sudo gedit /usr/local/bin/sharex11vnc
Isi filenya adalah:
#!/bin/sh
x11vnc -nap -bg -many -rfbauth ~/.vnc/passwd -desktop “VNC ${USER}@${HOSTNAME}”|grep -Eo “[0-9]{4}”>~/.vnc/port.txt
Ubah script tersebut agar executable:
$> sudo chmod 755 /usr/local/bin/sharex11vnc
Dan jangan lupa tambahkan ke session startup GNOME/KDE/Xfce agar dijalankan setiap kali login ke x window (via System > Preference > Sessions atau Applications > Settings > Autostarted Application).
Untuk mengakses remote desktop bisa digunakan vncviewer dari komputer client kita:
$> vncviewer 192.168.1.111
C.6. Gateway / Internet Connection Sharing
Jika server kita tehubung ke internet (baik melalui dial-up ataupun leased line), kita bisa membagi akses internet tersebut dengan komputer lain yang terhubung ke jaringan. Dengan demikian server kita berfungsi sebagai gateway.
Kita akan menggunakan 2 LAN/ethernet card. Ethernet pertama (eth0, 192.168.1.111) terkoneksi ke jaringan LAN melalui switch, ethernet kedua (eth1, 192.168.0.111) mengakses langsung ke sumber leased line akses (pada contoh ini adalah router ber-IP 192.168.0.254). Seluruh komputer yang ada di LAN nantinya harus mengarahkan gateway mereka ke eth0 (192.168.1.111) dan card eth0 tersebut mengarahkan gatewaynya ke eth1. Disini server harus disetting untuk bisa melakukan NAT (Network Address Translation) yang meneruskan request dari LAN ke IP publik atau sebaliknya. Untuk itu perlu diaktifkan IP forwarding dan beberapa baris perintah IPTABLES dengan membuat script sederhana:
$> sudo gedit /etc/init.d/gateway
Filenya berisi:
#! /bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A POSTROUTING -j MASQUERADE -t nat -s 192.168.1.0/24 -o eth1
Ubah menjadi executable dan dijalankan setiap komputer dinyalakan:
$> sudo chmod +x /etc/init.d/gateway
$> sudo sudo update-rc.d gateway defaults
C.7. Proxy Server (SQUID)
Dengan menggunakan SQUID, server kita bisa dijadikan proxy yang berfungsi sebagai:
1.Men-cache halaman web yang telah diakses sehingga aksesnya akan lebih cepat pada kali berikutnya
2.Memfilter alamat web mana saja yang boleh/tidak boleh diakses
3.Memfilter IP/user mana saja yang boleh mengakses internet
Instal Squid dan ubah file konfigurasi sesuai kebutuhan:
$> sudo apt-get install squid
$> sudo gedit /etc/squid/squid.conf
Isi konfigurasi:
http_port 3128 transparent
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
cache_mem 6 MB
cache_dir ufs /var/spool/squid 100 16 256
access_log /var/log/squid/access.log squid
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
dns_nameservers 202.134.0.155 202.134.2.5 203.130.196.5
hosts_file /etc/hosts
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT
acl jerbee src 192.168.1.2-192.168.1.32/255.255.255.255
acl blacklist url_regex -i “/etc/squid/blacklist.txt”
acl user12kbps src 192.168.1.0/255.255.255.0
acl workinghour time MTWHFA 09:00-23:50
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny blacklist
http_access allow localhost
http_access allow jerbee
http_access deny all
icp_access allow all
visible_hostname proxy-bdg.telkomspeedy.net.id
delay_pools 1
delay_class 1 3
delay_access 1 allow user12kbps
delay_access 1 deny all
delay_parameters 1 32000/32000 -1/-1 20000/32000
always_direct allow all
Untuk isi file blacklist.txt berisi alamat situs atau keyword yang akan kita blok:
$> sudo gedit /etc/squid/blacklist.txt
Contoh isi blacklist.txt:
.friendster.com
.playboy.com
Lalu tambahkan aturan iptables/firewall agar proxy bersifat transparan:
$> sudo gedit /etc/init.d/gateway
Kini isinya menjadi:
#! /bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A POSTROUTING -j MASQUERADE -t nat -s 192.168.1.0/24 -o eth1
iptables -t nat -p tcp -A PREROUTING -s 192.168.1.0/24 -d 0/0 –dport 80 -j REDIRECT –to-port 3128
Kita bisa membuat dua macam file konfigurasi (squidjamkerja.conf dan squidsantai.conf), dimana pada squidjamkerja.conf kita membatasi hak akses terhadap situs dan keyword tertentu. Kita akan konfigurasikan crontab agar squid menggunakan squidjamkerja.conf yang ketat sejak jam 9 pagi dan berubah ke squidsantai.conf selewat jam 16.00:
$> sudo /etc/crontab
Tambahkan kedua baris berikut untuk merubah konfigurasi Squid setiap jam 9.00 dan 16.00
00 9 * * * root cp /etc/squid/squidjamkerja.conf /etc/squid/squid.conf | /etc/init.d/squid restart
00 16 * * * root cp /etc/squid/squidsantai.conf /etc/squid/squid.conf | /etc/init.d/squid restart
Jangan lupa restart service cron:
sudo /etc/init.d/cron restart
.8. Samba Server
Untuk sharing dan akses jaringan windows di linux :
$>sudo apt-get install samba smbfs