ម៉ាស៊ីន​បម្រើ​ឯកសារ​ Samba

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.

The server will be configured to share files with any client on the network without prompting for a password. If the environment requires stricter access controls, see the section called “ការ​ធានា​នូវ​សុវត្ថិភាព​ឯកសារ​ 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.

  1. Edit the following key/value pairs in the [global] section of /etc/samba/smb.conf:

    workgroup = EXAMPLE
    ...
    security = user
    

    ប៉ារ៉ាម៉ែត្រ​ សុវត្ថិភាព​ ​ស្ថិត​នៅ​ខាង​ក្រោម​បំផុត​​​ក្នុង​ផ្នែក​ [global] និង​ត្រូវ​បាន​ផ្តល់​ជា​មតិយោបល់​តាម​លំនាំ​ដើម ។ ផ្លាស់​ប្តូរ​ EXAMPLE ដើម្បី​ផ្គូផ្គង​បរិស្ថាន​ជាក់​ស្តែង ។

  2. បង្កើត​ផ្នែក​ថ្មី​នៅ​ខាង​ក្រោម​ឯកសារ​ ឬ​មិន​​​ផ្តល់​មតិយោបល់​ចំពោះ​ឧទាហរណ៍​ណា​មួយ​​សម្រាប់​ថត​ដែល​ត្រូវ​ចែក​រំលែក ៖...

    [share]
    comment = Ubuntu File Server Share
    path = /srv/samba/share
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0755
    
    • មតិយោបល់ ៖ សេចក្តី​ពិពណ៌នា​ខ្លី​ៗ​អំពី​ការចែក​រំលែក ។ លៃតម្រូវ​ឲ្យ​សម ។

    • ផ្លូវ​ ៖ ផ្លូវ​ទៅ​កាន់​ថត​ដែល​ត្រូវ​ចែក​រំលែក ។

      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 WindowsExplorer.

    • គិត​ថា​យល់​ព្រម​ ៖ អនុញ្ញាត​ឲ្យ​កម្មវិធី​តភ្ជាប់​ទៅ​ការចែក​រំលែក​ ដោយ​មិន​ចាំបាច់​ផ្តល់​ពាក្យ​សម្ងាត់ ។

    • read only: determines if the share is read only or if write privileges are granted. Write privileges are allowed only when the value is no, as is seen in this example. If the value is yes, then access to the share is read-only.

    • បង្កើត​របាំង ៖ កំណត់​សិទ្ធិ​ដែល​ឯកសារ​ថ្មី​ត្រូវ​តែ​មាន​ នៅ​ពេល​បង្កើត ។

  3. 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

    The -p switch tells mkdir to create the entire directory tree if it doesn't exist. Change the share name to fit the environment.

  4. Finally, restart the Samba services to enable the new configuration:

    sudo /etc/init.d/samba restart
    

Warning

ការកំណត់​រចនាសម្ព័ន្ធ​ខាង​លើ​ផ្តល់​នូវ​សិទ្ធិ​ចូល​ដំណើរ​ការ​ទាំង​អស់​ទៅ​កាន់​កម្មវិធី​ខ្លះ​ដែល​​នៅ​លើ​បណ្តាញ​មូលដ្ឋាន ។ ចំពោះ​ការកំណត់​រចនាសម្ព័ន្ធ​សុវត្ថិភាព​បន្ថែម​ សូម​មើល​ the section called “ការ​ធានា​នូវ​សុវត្ថិភាព​ឯកសារ​ 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.

ធនធាន