Mainos / Advertisement:

Samba

From Taisto
Jump to navigation Jump to search
This page is a translated version of the page Samba and the translation is 100% complete.

Other languages:
English • ‎suomi

Samba is mainly known for it's file server properties, but it can also be used to add Linux machines to a domain. Samba can also be used to create domains, just like Active Directory Domain Services in Windows.

Installation

"Samba can be found on Debian installation DVD 1."

We install Samba from package manager:

 aptitude install samba

OR

 apt-get install samba

Samba's configuration file can be found under the path:

 /etc/samba/smb.conf

Network share in Samba

Open the samba configuration file

 nano /etc/samba/smb.conf

Public share (anonymous login):

To the end of the file:

 [share_name] 
 comment = comment
 writable = yes     (if you want to save something in this share) 
                     if you want to allow everybody to save in this share then remember you must give privileges (chmod 0777) 
 path = /path/to/share/
 public = yes

Secured share:

 security = user

This share demands a Unix user to log in. Remove the number sign (#) from the start of the line:

 security = user

Add this to the end of the file:

 [jaon_nimi]
 path = /path/to/share/
 browseable = yes
 writeable = yes
 valid users = user
 admin users = administrator

Save the file and close it.

Create a Samba login for your Unix user (must be the same username and we recommend using the same password).

 smbpasswd -a username

Define ownership rights for the directory in question

 chown -hR username /path  

And restart the samba service

 service samba restart 
 /etc/init.d/samba restart

Test Samba's configurations:

 testparm

Usage privileges for network share

Define who has the privileges to read, write or modify the files in a network share. Also remember to define proper usage privileges for the filesystem.

Setting Parameters Function Default
admin users (usernames) Root users Not defined
valid users (usernames) Users which can connect to the share Not defined
invalid users (usernames) Users which can't connect to the share Not defined
read list (usernames) Users which only have read privileges, even if the share is writable Not defined
write list (usernames) Users with write privileges Not defined
max connections amount Highest amount of simultaneous connections to share 0
guest only (only guest) yes/no If yes, then only guest can access share no
guest account username Define who is "guest" nobody


Example: For the user sara, matti and jussi privileges for a network share. The admin privilege belongs to antti.

[share]
      path = /home/share
      comment = Networkshare
      writable = yes
      valid users = sara antti jussi
      admin users = antti


Example: Only read privileges, but write privileges for matti and sara.

[sales]
      path = /home/share
      comment = Networkshare
      read only = yes
      write list = matti sara

Example: For guests

[share]
       path = /home/share
       comment = Networkshare
       writable = yes
       guest ok = yes
       guest account = ftp
       guest only = yes

Connecting to domain using samba

There is a separate guide on our wiki which discusses this: Linux AD connection

Sources

https://raymii.org/s/tutorials/SAMBA_Share_with_Active_Directory_Login_on_Ubuntu_12.04.html

Mainos / Advertisement: