Install Samba on  your HTPC and access files via Windows

Install Samba on your HTPC and access files via Windows

In order to access your file via Windows computers in your home network, you need a small software called Samba. It will install itself as a remote server and grant the access to some folder of your HTPC.

If you have XBMCBuntu instead of Ubuntu, you already will have Samba pre-installed. You might want to change some of the configuration, but straight out of the box it all works nicely!

You will see how to:

  1. Install and setup samba;
  2. Access your files via network;
  3. Create permanent credentials to avoid password prompts;
  4. Map your files to a windows virtual drive for ease of access.

INSTALL SAMBA ON UBUNTU:

  1. Install:
    sudo apt-get install samba
  2. Start:
    sudo /etc/init.d/samba start
  3. check the status via:
    sudo /etc/init.d/samba status
  4. Backup your config:
    sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bk
  5. Edit the configuration:
    sudo nano /etc/samba/smb.conf
  6. Exemple of a windows config file:
    [global]
      server string = Samba Server Version %v
      log file = /var/log/samba/log.%m
      max log size = 50
      security = user
      passdb backend = tdbsam
      load printers = yes
      cups options = raw
    
      hosts deny = ALL
      hosts allow = 192.168.2.
      guest ok = no
      wins support = yes
      workgroup = WORKGROUP
    
      [folder_user01]
        path=/home/user01/
        read only = no
        broweasable = yes
        valid users = user01
        writeable = yes
        write list = user01
    
      [printers]
        comment = All Printers
        path = /var/spool/samba
  7. Edit the file to your taste, check the documentation here: https://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html
  8. Add the user to samba:
    sudo smbpasswd -a user01
    and then type the password when prompted to
  9. Restart samba:
    sudo /etc/init.d/samba restart

ACCESS YOUR SAMBA SHARE IN WINDOWS:

  1. Open an explorer windows (WIN+E)
  2. In the address bar hit: \\192.168.2.20 (The ip address of your linux computer -> see Static IP)
  3. hit Enter
  4. If the connection is working, you will see the folders or will be prompt for username/passwords. If are having a timout issue, you might want to check your firewall settings in linux.
  5. If you are prompt for username/password and you should be: Enter the credential you just set via smbpasswd command in linux.

samba_windows


CREATE PERMANENT CREDENTIALS IN WINDOWS:

  1. In the control panel search for: User Accounts
  2. On left bar click on: Manage your credentialsmanagecredent
  3. Click on: Add a Windows credentialaddcred
  4. Type your linux ip address i.e. : \\192.168.2.20
  5. Then type the username and password of the user you granted the access to.setcred
  6. If everthing went well, you should have something like this:displaycred
  7. Now if you connect to your file you won’t be prompted for username/password anymore

MAP YOUR FILES TO A WINDOWS VIRTUAL DRIVE:

  1. Go to Computer (Win+E)
  2. Click on the top bar button: Map network drivemapdrives
  3. Choose your letter and Enter the Linux ip addressmapdrives_set
  4. You now have your linux samba share hooked up to drive letter in your windows with permanent credentials.mapped