Installation of samba

From Erlands Wiki

Jump to: navigation, search

Lets install samba to make it possible to mount shared directories from other machines on your network and to make it possible to share directories on your server to the Windows clients.

  • 1. sudo apt-get install samba smbfs
  • 2. sudo vi /etc/samba/smb.conf
  • 3. Make sure the following lines exist, you can ignore the stuff behind #
workgroup = <Your workgroup>
passdb backend = tdbsam:/etc/samba/passdb.tdb  #Specify tdb file to limit users with access rights
username map = /etc/samba/smbusers #Map file with mappings between Windows and Linux usernames
unix charset = ISO-8859-1 #Set characterset, only needed if linux is configured to a non utf-8 charset
unix extensions = no #We don't want unix extensions, softlinks shall be shown as a normal directory when mounted over samba
  • 4. Enable the [homes] section by removing the ; before it and also make sure the following lines exist in the [homes] section
writable = yes
create mask = 0755 #If we create files they shall be executable and readable for all users by default
directory mask = 0775 #Directories shall be readable for all users by default
  • 5. Enable the [cdrom] section by removing the ; before it and before all attributes in the [cdrom] section
  • 6. Add any section of your own using the same principles, for example:
[video]
   comment = Video files
   path = /mnt/video
   valid users = erland
   force group = erland
   browseable = yes
   read only = No
   create mask = 0660
   directory mask = 0770
   guest ok = no
   printable = no
  • 7. Save and exit
  • 8. Run the following command for all users that should be able to access the network shares and enter a password for them (replace xxx with their linux username)
sudo pdbedit -a -u xxx
  • 9. Create a file /etc/samba/smbusers and add a line for each user that has different username on linux and windows, for example where linux user name is “erland” and Windows user name is “Erland Isaksson” add a line like:
erland = “Erland Isaksson”
  • 10. Restart samba with: sudo /etc/init.d/samba restart

Samba is now configured and you shall be able to access your network shares.

Personal tools