Friday, 21. April 2006, 08:45:45
This is not the proper way to do things from a security perspective but IT WORKS!!!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 authenticationIn 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=userto
security=shareThis 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 wayIf 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 directoriesAs 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 directoriesWhen 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.