Samba is a free implementation of the SMB/CIFS protocol used by Windows systems for file sharing over a network, and it is the easiest way to share your linux storage with Windows PCs in a local network (also possible for Mac computers, but for that ones it is more recommended to use NFS rather than Samba).


Samba security can be customized in many ways in terms of users and permissions, basically in the same ways as you can do with Windows systems (just google samba for details) , but if your local network is 100% secure and what you need is a fast way to start sharing files with unrestricted access then you can start here.


NOTE: The following method should only be used in fully secured networks, as it will provide unrestricted  access to the storage, giving to all external users the same permissions as the local mistika user.  This means that with this method all the external users in your network will be able to copy or destroy all the files that they want!! (for more decent security please ask to a proper system administrator to configure a better security scheme)


STEP 1:


The main SAMBA configuration file is this one: 

 

/etc/samba/smb.conf


As root user, make a backup of that file,  and then edit the content with a text editor to look as below (this example will provide a network drive for the storage volume that is mounted at /REALTIME_STORAGE locally. You can use it as a reference for adding other similar volumes).


[global]

        workgroup = WORKGROUP

        printing = cups

        printcap name = cups

        printcap cache time = 750

        cups options = raw

        map to guest = Bad User

        include = /etc/samba/dhcp.conf

        logon path = \%L\profiles\.msprofile

        logon home = \%L\%U\.9xprofile

        logon drive = P:

        usershare allow guests = Yes

        username map = /etc/samba/usermap.txt


 [REALTIME_STORAGE]

        comment = REALTIME_STORAGE]

        path = /REALTIME_STORAGE

        guest ok = Yes

        browseable = Yes

        writeable = Yes

        create mask = 0777

        directory mask = 0777

        strict allocate = Yes

        read raw = Yes

        write raw = Yes

        strict locking = auto

        socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072

        min receivefile size = 16384

        use sendfile = true

        aio write size = 16384

        inherit owner = yes

        inherit group = Yes


STEP 2:


As you may have noticed, the important line in the above example is this one (it is probably the only line that you will need to add to your smb.conf file)


        username map = /etc/samba/usermap.txt



Now, as root user you have to create the file /etc/samba/usermap.txt file wit a text editorand just put this line on it


        mistika = *

The star symbol "*" means that ALL remote users will be remapped as the local "mistika" user, thus having exactly the same permissions as if they were the local "mistika" user.


STEP 3:


Finally, restart the samba services for the changes to make effect. Execute this command in a console:


sudo service smb restart


And to test the connection, go to a windows file browser in other computer  and in the Network section use the contextual menu to select Map a network drive (the exact menu name may change between windows versions and file browsers, but it should be prettty similar).  Then it will ask you for the the path to the network drive, which will use standard Windows CIFS naming (something like  \\server\folder ). For example, if the Mistika system has the ip 192.168.1.2 then you will need to type something like this:


192.168.1.2\\REALTIME_STORAGE


That's it. Please note that this is a very rudimentary example to provide unrestricted access. Only use it in a local network where all the users are fully reliable (also, as a minimum you should  set a password for the mistika user for minimal security).