Instalasi dan Konfigurasi Samba Folder Sharing
Teori
dulu nih, Samba adalah himpunan aplikasi yang bertujuan agar komputer dengan
sistem operasi Linux, BSD ( atau UNIX lainnya) dapat bertindak sebagai file dan
print server yang berbasis protokol SMB (session message block). Jaringan yang
semacam ini biasa dijumpai pada Windows workgroup atau Windows NT Domain. Samba
juga dilengkapi dengan beberapa program bantu sehingga sistem operasi Linux
(dan UNIX lainnya) bisa mengakses resources yang ada pada jaringan Windows yang
telah ada. Bisa dikatakan, Samba adalah jembatan penghubung antara Windows dan
UNIX.
Samba terdiri atas dua program yang
berjalan di background: SMBD dan NMBD. Secara singkat dapat disebutkan bahwa
SMBD adalah file server yang akan menghasilkan proses baru untuk setiap client
yang aktif sementara NMBD bertugas mengkonversi nama komputer (NetBIOS) menjadi
alamat IP sekaligus juga memantau share yang ada di jaringan. Kerja SMBD
sendiri diatur melalui file konfigurasi /etc/samba/smb.conf. Dengan membuat
file konfigurasi yang tepat, Samba dapat dijadikan file server, print server,
domain controller, dan banyak fungsi lainnya.
Untuk Instalasi dan Konfigurasi Samba, bisa ikuti
langkah-langkah di bawah ini :
- Install
paket samba dan kroni-kroninya :
apt-get install samba samba-common
samba-doc winbind smbclient
- Konfigurasi
file
/etc/samba/smb.conf
sebagai berikut atau ganti isi file
dengan code di bawah ini :
[global]
workgroup = INFESTGROUP
netbios name = khayat
server string = %h server (Samba, Ubuntu)
passdb backend = tdbsam
security = user
username map = /etc/samba/smbusers
name resolve order = wins bcast hosts
domain logons = yes
preferred master = yes
wins support = yes
workgroup = INFESTGROUP
netbios name = khayat
server string = %h server (Samba, Ubuntu)
passdb backend = tdbsam
security = user
username map = /etc/samba/smbusers
name resolve order = wins bcast hosts
domain logons = yes
preferred master = yes
wins support = yes
# Useradd scripts
add user script = /usr/sbin/useradd -m %u
delete user script = /usr/sbin/userdel -r %u
add group script = /usr/sbin/groupadd %g
delete group script = /usr/sbin/groupdel %g
add user to group script = /usr/sbin/usermod -G %g %u
add machine script = /usr/sbin/useradd -s /bin/false/ -d /var/lib/nobody %u
idmap uid = 15000-20000
idmap gid = 15000-20000
add user script = /usr/sbin/useradd -m %u
delete user script = /usr/sbin/userdel -r %u
add group script = /usr/sbin/groupadd %g
delete group script = /usr/sbin/groupdel %g
add user to group script = /usr/sbin/usermod -G %g %u
add machine script = /usr/sbin/useradd -s /bin/false/ -d /var/lib/nobody %u
idmap uid = 15000-20000
idmap gid = 15000-20000
#
sync smb passwords woth linux passwords
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .
passwd chat debug = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .
passwd chat debug = yes
unix password sync = yes
#
set the loglevel
log level = 3
log level = 3
[homes]
comment = Home
valid users = %S
read only = no
browsable = no
comment = Home
valid users = %S
read only = no
browsable = no
[netlogon]
comment = Network Logon Service
path = /home/samba/netlogon
admin users = Administrator
valid users = %U
read only = no
comment = Network Logon Service
path = /home/samba/netlogon
admin users = Administrator
valid users = %U
read only = no
[profile]
comment = User profiles
path = /home/samba/profiles
valid users = %U
create mode = 0600
directory mode = 0700
writable = yes
browsable = no
comment = User profiles
path = /home/samba/profiles
valid users = %U
create mode = 0600
directory mode = 0700
writable = yes
browsable = no
- Buat
beberapa direktori berikut sebagai domain logon dan profile :
mkdir
/home/samba
mkdir /home/samba/netlogon
mkdir /home/samba/profiles
mkdir /var/spool/samba
chmod 777 /var/spool/samba/
chown -R root:users /home/samba/
chmod -R 771 /home/samba/
mkdir /home/samba/netlogon
mkdir /home/samba/profiles
mkdir /var/spool/samba
chmod 777 /var/spool/samba/
chown -R root:users /home/samba/
chmod -R 771 /home/samba/
- Lalu
restart service samba :
/etc/init.d/samba
restart
atau
/etc/init.d/smbd restart
atau
/etc/init.d/smbd restart
- Ubah
file /etc/nsswitch.conf, pada baris :
hosts:
files dns
menjadi
hosts:
files wins dns
- Tambahkan
beberapa client pada file /etc/hosts :
127.0.0.1
localhost
10.10.0.10 infest
10.10.0.9 lamuk
10.10.0.8 inyong
10.10.0.10 infest
10.10.0.9 lamuk
10.10.0.8 inyong
- Tambahkan
user root kedalam user samba :
smbpasswd
-a root
New SMB password:
Retype new SMB password:
New SMB password:
Retype new SMB password:
- Buat
file /etc/samba/smbusers lalu isikan dengan :
root
= Administrator
mengartikan bahwa user root = user
administrator pada windows
- Sekarang
kita coba, apakah konfigurasi sudah benar :
smbclient
-L localhost -U%
akan menghasilkan :
Domain=[INFESTGROUP] OS=[Unix]
Server=[Samba 3.3.2]
Sharename Type Comment
——— —- ——-
netlogon Disk Network Logon Service
allusers Disk All Users
IPC$ IPC IPC Service (khayat-desktop server (Samba, Ubuntu))
my picture Disk
musik Disk
Domain=[INFESTGROUP] OS=[Unix] Server=[Samba 3.3.2]
——— —- ——-
netlogon Disk Network Logon Service
allusers Disk All Users
IPC$ IPC IPC Service (khayat-desktop server (Samba, Ubuntu))
my picture Disk
musik Disk
Domain=[INFESTGROUP] OS=[Unix] Server=[Samba 3.3.2]
Server Comment
——— ——-
INDRA khayat-desktop server (Samba, Ubuntu)
——— ——-
INDRA khayat-desktop server (Samba, Ubuntu)
Workgroup Master
——— ——-
INFEST INFEST
INFESTGROUP KHAYAT
——— ——-
INFEST INFEST
INFESTGROUP KHAYAT
- Lalu
kita setup domain group untuk windows, jalankan perintah :
net
groupmap modify ntgroup=”Domain Admins” unixgroup=root
net groupmap modify ntgroup=”Domain Users” unixgroup=users
net groupmap modify ntgroup=”Domain Guests” unixgroup=nogroup
net groupmap modify ntgroup=”Domain Users” unixgroup=users
net groupmap modify ntgroup=”Domain Guests” unixgroup=nogroup
- Tambah
user linux dan user samba dengan cara :
useradd
lamuk -m -G users
smbpasswd
-a lamuk
- Ubah
juga pada /etc/samba/smb.conf, tambahkan baris berikut :
[allusers]
comment = All Users
path = /home/shares/allusers
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
writable = yes
comment = All Users
path = /home/shares/allusers
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
writable = yes
- Restart
samba :
/etc/init.d/samba
restart
atau
/etc/init.d/smbd restart
atau
/etc/init.d/smbd restart
- Langkah
terakhir adalah memanggil shared folder dari komputer lain dalam jaringan
:
smb://infest/www-data/
atau
Windows OS dengan cara :
- click kanan pada mycomputer
- pilih computer name lalu change
- masukan domain PDC pada bagisn domain
- akan muncul windows yang meminta memasukan user dan password, pada langkah ini masukan user root dan password samba untuk user root
- OK
- Akan muncul bahwa kita sukses menjoinkan mesin windows ke PDC linux
- pilih computer name lalu change
- masukan domain PDC pada bagisn domain
- akan muncul windows yang meminta memasukan user dan password, pada langkah ini masukan user root dan password samba untuk user root
- OK
- Akan muncul bahwa kita sukses menjoinkan mesin windows ke PDC linux
Windows 7 uses a feature called Homegroup, which enhances the Workgroup
feature in order to make home networking easier for all Windows 7 computers.
However, this feature doesn't work on Linux or older versions of Windows. In
order to connect your Linux computers to Windows 7 computers and share files
and folders, you need to make a series of settings. The first setting is to
enable file sharing. Then, you need to change the Workgroup, so that all
computers belong to one Workgroup. In this tutorial I will demonstrate how to
enable file sharing and then how to configure and change the Workgroup on an
Ubuntu PC.
NOTE: Article updated to
work with Ubuntu 10.10 & 11.04.
Install the Sharing
Service in Ubuntu Linux
The
sharing service or Samba as
it is called in Ubuntu is not installed by default. The installation process of
Samba varies in complexity depending on the method you will be using. I will
show you the most easy and straightforward method to install Samba.
First,
in Ubuntu, open the Home Folder, located in the Places menu.
Next,
right-click on any folder from this window to open a contextual menu. From the
contextual menu, click on Sharing Options.
This
opens the Folder Sharing window.
Check the box next to ’Share this folder’.
A
warning window will pop-up stating that the sharing service is not installed.
Click on the Install service button.
Note: If you do not receive this warning, it means that the
sharing service is already installed and you should be able to share files and
folders. To change the Workgroup, follow the instructions found in the next
section.
Then
type your user account password and click on OK. The installation process will begin.
In a
few seconds, you will be notified that all changes have been successfully
applied. Click Closeand Ubuntu will ask to restart your session.
Save
any open files you might have and click Restart session. After the restart, the sharing
service is installed and fully functioning.
Configure and change the
Workgroup in Ubuntu
In
most cases you won’t have to change the Workgroup name because, by default,
Ubuntu, Windows and Mac OS X have the same Workgroup name, which is actually “workgroup”.
However, if you have to change it follow the steps detailed in this section.
Open
a Terminal window
and type the following command:
sudo gedit /etc/samba/smb.conf
.
Then,
press Enter. If you haven’t previously used the Terminal this session, Ubuntu will ask you to
type in your user account password.
Next,
the Samba configuration file will open in a gedit window. Scroll down, if necessary,
until you find the workgroup line, in the Global Settings section.
Edit the Workgroup name so that it will
match the name of the Workgroup you want to add your Ubuntu computer to.
Click
on Save and
restart Ubuntu so that the new settings get applied.
NOTE: If you have a network which includes Windows computers,
you need to make sure the Workgroup is setup the same as on your Ubuntu
computers. To learn how to do this, check out this tutorial: How to Change the Workgroup in Windows 7.
Tidak ada komentar:
Posting Komentar