Set up a Samba server on Linux

With a Samba server installed and running on Linux, we can access partly or the whole system via LAN.

Install Samba:

apt-get install samba

Follow the install wizard and enter “workgroup” or the group your network uses.

The outside access can be configured for a special directory and for a special user or it’s possible to see the entire system. The latter can be used for administration purposes via LAN, but it’s not recommended for production servers or for paranoiac users.

Set up restricted access

  1. (On the server) add a directory for samba shares
    mkdir /samba

    (Change the /samba directory according to your needs)

  2. Add a usergroup for samba
    groupadd sambagroup
  3. Give the directory to the group
    chgrp sambagroup /samba
  4. Change the rights
    chmod 0777 /samba
  5. Add a user
    useradd -g sambagroup winuser
  6. Give the user a password
    passwd winuser
  7. Add samba password. This will be the password to access the server.
    smbpasswd -a winuser
  8. Enable user in samba
    smbpasswd -e winuser
  9. Add the following to /etc/samba/smb.conf. Change the SambaShareName to a nice one.
    path = /samba
    writable = yes
    public = no
    valid users = winuser
    force create mode = 0777
    force directory mode = 0777
  10. Restart the Samba server (every time you make changes to /etc/samba/smb.conf, the Samba server needs to be restarted).
    /etc/init.d/samba restart

Set up full access

It’s not a problem to give full access to the whole system if the server isn’t accessible from outside the router or the local area network is accessed only by the developer(s).

  1. Add samba password
    smbpasswd -a root
  2. Enable user in samba
    smbpasswd -e root
  3. Add the following to /etc/samba/smb.conf
    valid users=root
    force create mode = 0777
    force directory mode = 0777
  4. Restart the Samba server
    /etc/init.d/samba restart

Note: in a Windows system, you will see the server as “SambaShareName”. Change this name accordingly.

Leave a Reply

Your email address will not be published. Required fields are marked *