How to share folders in Linux using samba

Have you tried sharing a folder in Linux, especially in OpenSuse? If you open your File Browser/Nautilus and you right clicked on a folder, you will see a “Sharing Options” and when you try to share a folder and hit on the “Create Share” button, there’s an error prompting at the window: ‘net usershare’ returned error 255: net usershare: usershares are currently disabled.

Well the solution to this problem is quite simple:

Note: Before starting make sure that Samba is already installed and that the Samba daemon are already started:

Starting the Samba daemon

As root:

rawswift:~ # /etc/init.d/smb start
Starting Samba SMB daemon                                            done
rawswift:~ #

Now here’s what you will do next (as root):

  1. Edit ‘/etc/samba/smb.conf’.
    rawswift:~ # vi /etc/samba/smb.conf
    

    add the following under the “[global]” category:

    usershare allow guests = Yes
    usershare max shares = 100
    usershare owner only = False
    
  2. Create the ‘usershare’ directory (this is where Samba will store the lists of shared folders).
    rawswift:~ # mkdir /var/lib/samba/usershares
    rawswift:~ # chgrp users /var/lib/samba/usershares/
    rawswift:~ # chmod 1770 /var/lib/samba/usershares/
    
  3. Then finally, restart Samba daemon:
    rawswift:~ # /etc/init.d/smb restart
    Shutting down Samba SMB daemon                                       done
    Starting Samba SMB daemon                                            done
    rawswift:~ #
    

That’s it! Simple, eh?

Share a folder

  1. Open your file browser/Nautilus.
  2. Right click the folder you want to share.
  3. Click ‘Sharing Options’.
  4. Tick ‘Share this folder’ and ‘Guest access (for people without a user account)’.
  5. And hit ‘Create Share’ button.