
One of the most common ways to network Kubuntu™ and Windows™ computers is to configure Samba as a file server. This section covers setting up a Samba server to share files with Windows™ clients.
Pelayan akan dikonfigur untuk kongsi fail dengan sebarang klien dalam rangkaian tanpa maklumkan kata laluan. Jika persekitaran memerlukan kawalan capaian lebih ketat, rujuk the section called “Ketatkan keselamatan Pelayan Fail dan Cetak Samba”.
The first step is to install the Samba package. From a terminal prompt, enter:
sudo apt-get install samba
That's all there is to it. Samba is ready to be configured for file sharing.
The main Samba configuration file is located in /etc/samba/smb.conf
. The default configuration file has a significant number of comments in order to document various configuration directives.
Note
Not all of the available options are included in the default configuration file. See the smb.conf
man page or the Samba HOWTO and Reference Guide for more details.
Edit the following key/value pairs in the [global] section of
/etc/samba/smb.conf
:workgroup = EXAMPLE ... security = user
Parameter keselamatan adalah lebih jauh dibawah di dalam bahagian [global], dan diulas secara lalai. Ubah CONTOH untuk padankan dengan persekitaran sebenar.
Cipta bahagian baru pada bahagian bawah fail, atau nyahulas salah satu contog direktori yang akan dikongsi:
[share] comment = Ubuntu File Server Share path = /srv/samba/share browsable = yes guest ok = yes read only = no create mask = 0755
comment: keterangan ringkas perkongsian. Laras untuk suai muatkan.
path: laluan ke direktori untuk dikongsi.
This example uses
/srv/samba/sharename
because, according to the Filesystem Hierarchy Standard (FHS), /srv is where site-specific data should be served. Technically, Samba shares can be placed anywhere on the filesystem as long as the permissions are correct, but adhering to standards is recommended.browsable: enables Windows™ clients to browse the shared directory using Windows™ Explorer.
guest ok: benarkan klien menyambung ke perkongsian tanpa sediakan kata laluan.
read only: tentukan jika perkongsian adalah baca sahaja atau jika kelayakan tulis diberi. Kelayakan tulis hanya dibenarkan bila nilai adalah no, sepertimana dalam contoh ini. Jika nilai ialah yes, maka capaian ke perkongsian adalah baca-sahaja.
create mask: tentukan keizinan fail baru yang akan dicipta.
Now that Samba is configured, the directory needs to be created and the permissions changed. From a terminal, enter:
sudo mkdir -p /srv/samba/share sudo chown nobody.nogroup /srv/samba/share/
Note
-p beritahu mkdir supaya mencita keseluruhan pepohon direktori jika tidak wujud. Ubah nama kongsi untuk sesuaikan dengan persekitaran.
Finally, restart the Samba services to enable the new configuration:
sudo /etc/init.d/samba restart
Warning
Konfigurasi diatas memberikan semua capaian kepada mana-mana klien dalam rangkaian setempat. Untuk konfigurasi lebih selamat, rujuk the section called “Ketatkan keselamatan Pelayan Fail dan Cetak Samba”.
From a Windows™ client, it should now be possible to browse to the Kubuntu™ file server and see the shared directory. To check that everything is working, try creating a directory from Windows™.
To create additional shares, simply create new [dir] sections in /etc/samba/smb.conf
, and restart Samba. Make sure that the directory to be shared actually exists and that the permissions are correct.
For in depth Samba configurations see the Samba HOWTO and Reference Guide
The guide is also available in printed format.
O'Reilly's Using Samba, 3rd Edition is another good reference.