CLICK HERE FOR BLOGGER TEMPLATES AND MYSPACE LAYOUTS »

Selasa, 28 Oktober 2008

TUTORIAL SAMBA

Kuliah Umum IlmuKomputer.ComCopyright © 2004 IlmuKomputer.ComTutorial Samba Tutorial SambaAskari Azikindaeng_rewa@students.stttelkom.ac.idAbstrak:Samba (server message block) adalah protokol file sharing dan printer sharing untuk menyaingi protokol yangtelah ada yakni Novell’s IPX-based. SMB ini merupakan protokol file sharing dan printer sharing pertama yangdapat berjalan pada multi protokol: TCP/IP, NetBEUI, IPX/SPX. Dengan kata lain SMB server dapatmenggantikan posisi Novell server tanpa harus merubah infrastruktur dari jaringan itu sendiri.
Server LAN untuk pemakai Ms-Windows dan GNU/LinuxSamba (server message block) adalah protokol file sharing dan printer sharing untuk menyaingiprotokol yang telah ada yakni Novell’s IPX-based. SMB ini merupakan protokol file sharing danprinter sharing pertama yang dapat berjalan pada multi protokol: TCP/IP, NetBEUI, IPX/SPX.Dengan kata lain SMB server dapat menggantikan posisi Novell server tanpa harus merubahinfrastruktur dari jaringan itu sendiri.Konfigurasi SambaLogin sebagai user root, kemudian lakukan editing dengan menggunakan text editor pada file /etc/samba/smb.confkari@debian:~# pico /etc/samba/smb.confBerikut file konfigurasi samba.conf :[global]# Change this for the workgroup/NT-domain name your Samba server will partofworkgroups = edo391Lisensi Dokumen:Copyright © 2004 IlmuKomputer.ComSeluruh dokumen di IlmuKomputer.Com dapat digunakan, dimodifikasi dan disebarkan secarabebas untuk tujuan bukan komersial (nonprofit), dengan syarat tidak menghapus atau merubahatribut penulis dan pernyataan copyright yang disertakan dalam setiap dokumen. Tidakdiperbolehkan melakukan penulisan ulang, kecuali mendapatkan ijin terlebih dahulu dariIlmuKomputer.Com.Kuliah Umum IlmuKomputer.ComCopyright © 2004 IlmuKomputer.Com# server string is the equivalent of the NT Description fieldserver string = %h server (Samba %v); guest account = nobodyinvalid users = root# If you want Samba to log though syslog only then set the following# parameter to 'yes'. Please note that logging through syslog in# Samba is still experimental.; syslog only = no# We want Samba to log a minimum amount of information to syslog.Everything# should go to /var/log/samba/log.{smb,nmb} instead. If you want to log# through syslog you should set the following parameter to somethinghigher.syslog = 0# "security = user" is always a good idea. This will require a Unixaccount# in this server for every user accessing the server. See# security_level.txt for details.; security = user# You may wish to use password encryption. Please read ENCRYPTION.txt,# Win95.txt and WinNT.txt in the Samba documentation. Do not enable this# option unless you have read those documentsencrypt passwords = false# Using the following line enables you to customise your configuration# on a per machine basis. The %m gets replaced with the netbios name# of the machine that is connecting; include = /home/samba/etc/smb.conf.%m# Most people will find that this option gives better performance.# See speed.txt and the manual pages for details# You may want to add the following on a Linux system:# SO_RCVBUF=8192 SO_SNDBUF=8192socket options = TCP_NODELAY# --- Browser Control Options ---# Please _read_ BROWSING.txt and set the next four parameters according# to your network setup. The defaults are specified below (commented# out.) It's important that you read BROWSING.txt so you don't break# browsing in your network!# set local master to no if you don't want Samba to become a master# browser on your network. Otherwise the normal election rules apply; local master = yes2Kuliah Umum IlmuKomputer.ComCopyright © 2004 IlmuKomputer.Com# OS Level determines the precedence of this server in master browser# elections. The default value should be reasonable; os level = 20# --- End of Browser Control Options ---# Windows Internet Name Serving Support Section:# WINS Support - Tells the NMBD component of Samba to enable it's WINSServer; wins support = no# WINS Server - Tells the NMBD components of Samba to be a WINS Client# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both; wins server = w.x.y.z# This will prevent nmbd to search for NetBIOS names through DNS.dns proxy = no# What naming service and in what order should we use to resolve hostnames# to IP addresses; name resolve order = lmhosts host wins bcast# Name mangling options; preserve case = yes; short preserve case = yes# This boolean parameter controlls whether Samba attempts to sync. theUnix# password with the SMB password when the encrypted SMB password in the# /etc/samba/smbpasswd file is changed.; unix password sync = false# For Unix password sync. to work on a Debian GNU/Linux system, thefollowing# parameters must be set (thanks to Augustin Luton <aluton@hybrigenics.fr>for# sending the correct chat script for the passwd program in DebianPotato).passwd program = /usr/bin/passwd %upasswd chat = *Enter\snew\sUNIX\spassword:* %n\n*Retype\snew\sUNIX\spassword:* %n\n .# This boolean controls whether PAM will be used for password changes# when requested by an SMB client instead of the program listed in# 'passwd program'. The default is 'no'.; pam password change = no# The following parameter is useful only if you have the linpopup package# installed. The samba maintainer and the linpopup maintainer are3Kuliah Umum IlmuKomputer.ComCopyright © 2004 IlmuKomputer.Com# working to ease installation and configuration of linpopup and samba.; message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &obey pam restrictions = yes# Some defaults for winbind (make sure you're not using the ranges# for something else.); winbind uid = 10000-20000; winbind gid = 10000-20000; template shell = /bin/bash#======= Share Definitions ========[homes]comment = Home Directoriesbrowseable = yespublic = yesread only = yes[win_i]comment = berisi lagu - lagubrowseable = yesread only = yespublic = yesguest ok = yeswritable = nopath = /windows/win_i/# By default, the home directories are exported read-only. Change next# parameter to 'yes' if you want to be able to write to them.writable = no# File creation mask is set to 0700 for security reasons. If you want to# create files with group=rw permissions, set next parameter to 0775.create mask = 0700# Directory creation mask is set to 0700 for security reasons. If you wantto# create dirs. with group=rw permissions, set next parameter to 0775.directory mask = 0700# Un-comment the following and create the netlogon directory for DomainLogons# (you need to configure Samba to act as a domain controller too.);[netlogon]; comment = Network Logon Service; path = /home/samba/netlogon; guest ok = yes; writable = no; share modes = no4Kuliah Umum IlmuKomputer.ComCopyright © 2004 IlmuKomputer.Com[printers]comment = All Printersbrowseable = yespath = /tmpprintable = yespublic = yeswritable = nocreate mode = 0700locking = no# A sample share for sharing your CD-ROM with others.[cdrom]comment = Samba server's CD-ROMwritable = yeslocking = nopath = /cdrompublic = yes# The next two parameters show how to auto-mount a CD-ROM when the# cdrom share is accesed. For this to work /etc/fstab must contain# an entry like this:## /dev/scd0 /cdrom iso9660 defaults,noauto,ro,user 0 0## The CD-ROM gets unmounted automatically after the connection to the## If you don't want to use auto-mounting/unmounting make sure the CD# is mounted on /cdrom#; preexec = /bin/mount /cdrom; postexec = /bin/umount /cdromKeterangan:Workgroup : setiap host atau client yang terhubung ke dalam satu jaringan yang sama (satu group)baik windows ataupun linux harus memiliki workgroup yang sama.guest account : diset sebagai nobody; guest account ini mengatur pemberian hak izin write ke semuauserSecurity : option defaultnya adalah “user”, “share”, “server”, dan “domain”comment : komentar tentang drive tersebutpath : letak direktori yang akan dishareread-only : option defaultnya adalah “yes” sehingga semua host yang ada tidak dapatmelakukan perubahan apapun terhadap drive tersebut5Kuliah Umum IlmuKomputer.ComCopyright © 2004 IlmuKomputer.Comlocking : hak izin read only untuk filesystem ataupun perangkat device (CD-ROM)browseable : Option defaultnya adalah “yes” sehingga drive yang dishare akan tampak padakomputer lainPublic : option ini menyebabkan semua host dapat mengaksesfile atau direktori yang tershare tanpa adanya permintaan password dari komputer tersebutguest ok : fungsinya sama dengan publiccreate mode : option ini untuk mengatur hak–hak yang akan diberikan kepada host lain terhadap fileatau direktori yang akan dishare.writable : option ini memberikan hak azas kepada host lain untuk melakukan perubahan pada fileatau direktori yang anda share. Pilihan defaulnya adalah “no”.Setelah anda melakukan perubahan pada file konfigurasi di atas, restart kembali service samba andauntuk mendapatkan perubahan pada file konfigurasi tersebut. Perintah yang digunakan adalah:Kari@debian:~# /etc/init.d/samba restartUntuk melihat file atau direktori yang telah anda dan komputer lain share, anda dapat menggunakanbrowser konqueror yang mendukung protokol samba. Pada Url ketikkan smb://namahost atausmb://IP addressJika nama host atau IP_address yang anda masukkan ada dalam jaringan anda, maka konquerorwebrowser akan menampilkan isi dari direktori yang dishare oleh komputer lain.Selain mengakses file sharing dengan browser konqueror, anda juga menggunakan LinNeighborhoodyang tampilannya mirip dengan My Network Places pada microsoft windows.


Keterangan:
alamat ip anda masukkan sesuai dengan IP address komputer yang dituju (mis: 10.14.231.1)
Namahost diisi dengan namahost yang sesuai dengan komputer tujuan
Selain itu anda juga dapat menggunakan perintah pada konsole. Bagi anda yang senang
menggunakan konsole, maka anda perlu mencoba akses file sharing dengan text mode.
Beberapa perintah yang dapat digunakan untuk file sharing dengan samba:
6
Kuliah Umum IlmuKomputer.Com
Copyright © 2004 IlmuKomputer.Com
Akses file sharing dengan smbclient
Berikut ini adalah perintah yang digunakan dalam mengakses file sharing dengan menggunakan
perintah smbclient
kari@debian# smbclient –L //hostname/fileshare
added interface ip=192.168.1.2 bcast=192.168.1.255
nmask=255.255.255.0
password:
Domain=[CURTIS] OS =[unix] server=[samba 2.0.7]
Smb: \> dir
. D 0 Tue oct 24 18:58:00 2003
.. D 0 Tue oct 25 17:58:00 2003
data D 0 Mon oct 27 17:58:00 2003
Smb: \> cd data
Smb: \data\> dir
. D 0 Tue oct 24 18:58:00 2003
.. D 0 Tue oct 25 17:58:00matakuliah D 0 Tue
oct 25 17:58:00 2003
Smb: \data\> get matakuliah
Getting file matakuliah of size 3042 as matakuliah (86.8301 kb/s)
Smb: \data\> exit
Akses file sharing dengan smbsh dan smbfs
Selain menggunakan smbclient untuk akses file sharing dengan windows, smbsh dan smbfs juga
dapat digunakan sebagai alternatif lain dalam pengaksesan file sharing. Prinsip kerjanya adalah file
sharing yang ingin dibuka dengan mesin linux akan dimaping ke direktori/path yang ada pada mesin
linux. Perintah yang digunakan adalah:
kari@debian:~# insmod smbfs
kari@debian:~# smbmount //hostname/direktori$ /pathlinux –o
username=namauser,workgroup=Workgroup,uid=root,gid=staff,fmask=0664,dmask=0775
password:*****(password username yang anda masukkan)
kari@debian:~# cd /pathlinux/direktori$
kari@debian/direktori$# ls
atau
kari@debian:~#mount –t smbfs –o username=namauser //IP_address/direktori_share /pathlinux
kari@debian:~# cd /pathlinux/direktori_share
kari@debian/direktori$# ls
Keterangan:
7
Kuliah Umum IlmuKomputer.Com
Copyright © 2004 IlmuKomputer.Com
Perintah insmod digunakan untuk memastikan bahwa modul kernel smbfs telah terinstall pada
sistem.
hostname diisi dengan hostname tujuan yang ingin anda akses
direktori diisi dengan direktori yang ingin anda akses yang diakhiri dengan tanda dollar ($).
direktori_share diisi dengan direktori share orang yang ingin diakses oleh anda.
pathlinux diisi dengan direktori linux tempat anda memaping file sharing windows (misal:/mnt/).
username diisi dengan username yang ada pada komputer tujuan, bukan username yang ada pada
komputer anda.
workgroup diisi dengan workgroup yang anda gunakan
password diisi dengan password sesuai password dari username yang anda masukkan.
cat: Antara direktori$ dan /pathlinux serta direktori_share dan /pathlinux harus ada spasi yang
memisahkan.
Misal:
Anda ingin mengakses komputer lain dengan username debianlinux, sedangkan direktori yang anda
ingin akses dari komputer tersebut adalah win_c dan anda petakan pada pathlinux yaitu /mnt/.
Perintah yang digunakan adalah:
kari@debian# mount –t smbfs –o username=debianlinux //10.14.200.20/win_c /mnt
kari@debian# cd /mnt
kari@debian# ls
Konfigurasi server printer
Untuk menggunakan printer pada server windows, anda harus membuat file konfigurasi printer
server. Letak file konfigurasi printer server tersebut di direktori $SPOOL_DIR/lpd/ .
Misal printer yang ada pada server adalah canon bj2100sp. Maka pada konsole, gunakan perintah:
kari@debian# cat /var/spool/canon/.config
server = DHE
service = CANON
password=””
Untuk mengirimkan print job ke server windows, gunakan perintah:
pakedo@debian$ smbprint /var/spool/lpd/canon/acct
Jika printer anda tidak mendukung format option postScript text, anda dapat menggunakan
Ghostscript (gs) untuk mengkonversi file postScript ke format yang didukung oleh printer tersebut.
Gunakan perintah:
8
Kuliah Umum IlmuKomputer.Com
Copyright © 2004 IlmuKomputer.Com
pakedo@debian:~$ cat myfile.ps gs –q –dSAFER –sDEVICE=bj2100sp –dQuality=1 –dNOPAUSE
\ -sOutputFile=- - smbprint /var/spool/lpd/canon/acct
Kemudian lakukan editing pada file konfigurasi /etc/printcap, tambahkan baris berikut:
# /etc/printcap:printer capability database. See printcap(5)
.
.
.
canoncanon bj-2100sp on dhe:\
:sd=/var/spool/lpd/canon:\
:af=/var/spool/lpd/canon/acct:\
:mx#0:\
:sh:\
:of=/etc/printing/canon.filter:
.
.
.
REFERENSI
Azikin, A., Adi, A.S., Adi, G., 2004. Debian GNU/Linux. Andi Offset Yogyakarta, Indonesia.

0 komentar:

kasih makan ya...