Setting up Samba to share Linux and Windows files
This is what worked for me. Your mileage will definitely vary. This is also assuming you’re using a Linux distro that is set up to install via rpm and you’re using the Nautilus file manager and the Windows version you are accessing is Windows 7. This will NOT work for Debian/Ubuntu type distros.
First, make sure samba is installed. Do
rpm -q samba. You should get back something like:
samba-3.6.4-1.fu2012.x86_64. It will be different for you, most likely. If you don’t have it, you’ll have to get it from your packages repository. Get:
If it’s installed, make sure it’s running:
service --status-all | grep smbd
which should return something like:
smbd (pid 11767) is running...
Go to your firewall’s configuration app (or do this via command line if you know how) and make sure Samba and Samba Client are enabled in it.
OK, edit your config file. Do
sudo gedit (or whatever editor you want to use) /etc/samba/smb.conf
The sections we need to look at are under
workgroup = and put your Windows workgroup name there. 99 times out of 100, if you’re on a home Windows network, it’ll be WORKGROUP unless you’ve changed it. So if it is, make sure that line says
workgroup = WORKGROUP.
Make sure there’s a
; in front of the rest of the entries here, i.e where it says NetBIOS, interfaces, hosts allow, etc, unless you have a pressing need to change them. I’ve found through trial and error, it’ll connect to your shares whether you state the interface or not, so just leave it commented out with a semi-colon.
Directly underneath where it says
hosts allow add:
usershare allow guests = Yes
usershare max shares = 100
usershare owner only = False
If you don’t want guests on your network accessing your shares, put false there. This will also grey out the guests option in Nautilus when we get to it. If you only want the owner (that is, Linux owner) of the files accessing the shares, make that line true.
Create the storage folders: Do
id yourname as your non-root user and see what groups you belong to. If you belong to the
wheel group (for instance) then do the following as sudo:
chgrp wheel /var/lib/samba/usershares
chmod 1770 /var/lib/samba/usershares
If you don’t belong to the wheel group do:
sudo useradd -G wheel yourname. Of course, if there isn’t a wheel group (unlikely) then do
sudo groupadd wheel. Logically, you can use the above to create any group name you want and add yourself to it.
Now, create a samba password for your user. The user needs to exist in /etc/passwd for this to work. If you use your normal login name, this won’t be an issue otherwise you’ll need to do useradd or adduser and create a new user.
sudo smbpasswd - a yourname.
Now, create your shares in Nautilus.
Open up /etc/samba/smb.conf and check down the bottom. It should have added a new section to it. If not, add the following:
path = /home/yourname/Downloads
read only = no
browseable = yes
valid users = yourname
service samba restart or
rcsmb restart. Whichever works.
Go to another networked machine and connect to whatever IP address your new shares are on (do
ifconfig on the shared machine to find out). It should prompt you for your user name and password. Enter them and voila! Shared files!
To share from Windows so Linux can see them, create a password for your login if you haven’t already in the Users section of Control Panel. You’ll need one for Linux to access it even if your Windows machines are joined without needing a password (pretty common occurrence). Or you can create a user specifically for Linux to connect.
Make sure sharing is enabled in your firewall and in Control Panel, and right click the folders/files you want to share. Presto. It’s as easy as that. Go to your Linux box, and connect to
smb://whatever_your_Windows_IP_is and enter your credentials. Easy.
Kudos to http://www.swerdna.net.au/susesimpleshares.html for the assistance.