Practical Web Programming

Friday, December 23, 2016

How to Install and Configure Samba in Ubuntu 16.04

  1. Install Samba
      sudo apt-get update
      sudo apt-get install samba
    
  2. Set a password for your user in Samba
      sudo smbpasswd -a <user_name>
    
    Note: Samba uses a separate set of passwords than the standard Linux system accounts (stored in /etc/samba/smbpasswd). Having said that, I always use here whatever username I use for my Linux account.
  3. Create a directory to be shared
      
    mkdir /home/<user_name>/<folder_name>
    
  4. Edit the file "/etc/samba/smb.conf"
      
      sudo vim /etc/samba/smb.conf
    
    And add the following:
      
    [global]
      workgroup = HOME_NETWORK
    
    #(Set this to the name you want the shared folder to have)
    [share]
       comment = File server share folder
       path = /home/<user_name>/share/
       browsable = yes
       read only = no
       guest ok = yes
       writable = yes
       valid users = <samba_user_name>
       create mask = 0755
    
  5. If you setup a firewall, allow port 445
      ufw allow 445
    
  6. Restart the samba:
        sudo service smbd restart
    
  7. Once Samba has restarted, use this command to check your smb.conf for any syntax errors
        testparm  
    

0 comments:

Recent Post