How to unsecure Samba
Friday, 21. April 2006, 08:45:45
In Gnome under Ubuntu there is a menuchoice:
System -> Administration -> Shared Folders
This let's you set up shared folders via Samba, but it will never let you access those folders from another computer, thus making it totally useless.
When a windows user selects a folder for sharing that folder is accessible to all users on the network, and that is probably how you'd expect it to work if you try to do the same thing under Linux. That's just not the case. You may share folders till your eyes pops out, but that is all that is going to happen. All this security is probably a good thing in a corporate network, but on a home-network, protected by a firewall, it's just one big hassle.
Turning off Samba authentication
In order to make those folders you share with the Gnome front-end samba app you need to unsecure Samba a bit. It is just a tiny line you need to add to your smb.conf file:
Change
;security=user
to
security=share
This says to samba that users connecting through Samba don't need an account on the linux machine. Now if you create a shared folder, remote users can access it as long as they can connect to the linux machine and the permissions for that folder allows "other" to read and write. By setting security = share you avoid the following steps for each new sambauser:
sudo useradd newsambauser sudo passwd newsambauser enter system account password enter system account password sudo smbpasswd -a newsambauser enter samba password enter samba password sudo /etc/init.d/samba restart
Security the easy way
If you worry about security, you can specify the ip-adresses that are allowed to access via Samba to allow only IP adresses on your local network. On my network every computer gets an IP between 10.0.0.2 and 10.0.0.255 so inserting the following line in the global section of smb.conf will make sure only computers on my network will have access to samba:
hosts allow = 10.0.0.
Proper permissions for existing files and directories
As stated above the permissions for the existing files and directories you share must be correct. They must be readable and writable by everyone. Use this command to allow "other" and "group" read and write permission:
sudo chmod -R 777 /home/share
This will recursively give all files and folders below /home/share, including the share folder read/write permissions.
Proper permissions for new files and directories
When you add a new folder or a file to your new share you'd want everybody to automatically have read/write permissions to it. This is accomplished by specifying the "create mask" and
"directory mask" properties in smb.conf like shown below:
[global] security = share [public] comment = Public Folder path = /home/share public = yes writable = yes create mask = 0777 ///// New files are created with rwxrwxrwx permissions. directory mask = 0777 // New directories are created with rwxrwxrwx permissions.



Nequissimus # 9. September 2006, 12:04
"How to unsecure Samba" = "How to make it like Windows"
Works pretty well but I would not recommend this
Mr Green # 10. September 2006, 08:02
The main reason I wrote this is that Samba is a big hurdle for new users. And almost everyone wants some kind of filesharing between their computers.
Anonymous # 3. October 2006, 17:28
Thanks for the information!
It worked perfectly (although I understand the potential risks)
Anonymous # 5. December 2006, 19:45
How do I share both Public folders (as you describe above) and at the same time share folders that require a user account? If I simply set the 'security=share' then I no longer get the security I want with 'other' folders ...
Anonymous # 26. February 2007, 05:02
Yeah...i have some public folders and some non-public folders..how can i secure some and unsecure others?
Anonymous # 8. September 2008, 18:19
Thanks for the info!! This was exactly what I needed and worked the first time. Saved me a lot of time figuring it out!