» Follow me on Twitter
After hours of trying and trying and trying, I finally got my two PCs and my laptop to share files seamlessly at home. All three run on Debian Linux Testing. Basically what I wanted was for any user on any of these machines to be able to share files with each other. Each PCs shared folder should be fully writeable and readable to the other machines. I admit that this is not a secure setup but the topic is not about security anyway. I might tackle that next time.
So here’s what I did. Instructions will be for Debian users though you other Linux distro users will most likely get the idea.
Step 1. Install the necessary stuff and create necessary folders
# su
# apt-get update
# apt-get install samba smbfs smbclient autofs
# mkdir -p /path/to/shared/folder
# chmod 0777 /path/to/share/folder
# mkdir -p /path/to/automount/point
Step 2. Edit Samba config file
Edit /etc/samba/smb.conf so that it looks something like this:
[global]
workgroup = MYGROUP
[sharename]
path = /path/to/shared/folder
read only = No
create mask = 0777
directory mask = 0777
guest ok = Yes
browseable = Yes
Step 3. Edit /etc/auto.smb file
Look for the line that says, ‘opts=”-fstype=cifs”‘ and change it to ‘opts=”-fstype=smbfs,fmask=0777″‘ then save the file.
Step 4. Edit /etc/auto.master file
Add the following line to your /etc/auto.master file.
/path/to/automount/point /etc/auto.smb –timeout=2
Save the file.
Step 5. Restart Samba and Autofs services
# /etc/init.d/samba restart
# /etc/init.d/autofs restart
Step 6. Do the same for each PC that in your network that you want to have a shared folder of their own.
Step 7. Test it.
To test it, do this as any user in your system
# cd /path/to/automount/point/computername/sharename
Note that the computername/sharename won’t appear in your /path/to/automount/point until they are accessed. This is a normal behaviour of autofs.
Tip: You can create a symlink to each shared folder for easier access. What I usually do is:
# mkdir /shares
# cd /shares
# ln -s /path/to/automount/point/computername1 .
# ln -s /path/to/automount/point/computername2 .
This way, I can easily browse through all shared folders by using any GUI file manager. (By the way, I use Thunar - apt-get install thunar). The symlink will simply appear as a broken link if the share is not available and will restore itself when the share becomes available.
Ok, I guess that’s about it. You now have an automounting samba shared folder for every PC that you want and is fully writeable and readable to any user in the system. I hope this helps you.
» Follow me on Twitter