Samba failiserver

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 faili- ja prindiserveri turvamine”

Paigaldamine

Esimeseks sammuks on samba paketi paigaldamine. Selleks sisesta käsureale järgmist:

sudo apt-get install samba

That's all there is to it. Samba is ready to be configured for file sharing.

Seadistamine

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

Kõik saadaval valikud on vaikimisi seadistusfailis. Vaata smb.confman lehte või Samba HOWTO Collection lisainfo saamiseks.

  1. Redigeeri järgnevat võtme/väärtustepaari [global] sekstsiooni /etc/samba/smb.conf:

    workgroup = EXAMPLE
    ...
    security = user
    

    The security parameter is farther down in the [global] section, and is commented out by default. Change EXAMPLE to match the actual environment.

  2. Create a new section at the bottom of the file, or uncomment one of the examples for the directory to be shared:

    [share]
    comment = Ubuntu File Server Share
    path = /srv/samba/share
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0755
    
    • comment: a short description of the share. Adjust to fit as appropriate.

    • asukoht: kataloogi asukoht jagamiseks.

      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.

    • lehitsetav: lubab Windowsi klientidel lehitseda jagatud katalooge, mis kasutavad Windows Explorerit.

    • guest ok: lubab klientidel ühenduda jagamistega ilma parooli sisestamata.

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

    • create mask: determines the permissions new files will have when created.

  3. Nüüd kui Samba on seadistatud, on vajalik kataloogi loomine ning teha õiguste muudatused. Selleks sisesta terminali järgnev:

    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. Taaskäivita samba teenused, et lubada uut seadistust:

    sudo /etc/init.d/samba restart
    

Warning

The above configuration gives all access to any client on the local network. For a more secure configuration, see the section called “Samba faili- ja prindiserveri turvamine”.

Windowsi kliendiga peaks olema nüüd võimalik lehitseda Kubuntu failiserverit ja näha jagatud kataloogi. Kontrolli, kas kõik töötab ning proovi luua Windowsist uus kataloog.

Selleks, et luua lisanduvaid jagamisi, loo lihtsalt uued [dir] sektsioonid /etc/samba/smb.confi ning taaskäivita Samba. Ole kindel, et kataloog, mida jagad, on olemas ning õigused on korrektsed.

Ressursid