Saturday, December 09, 2006

File Sharing on Ubuntu

I have a desktop (I'll call my server) that all of my files are on and a laptop with which I need to access the files on my desktop. Both run ubuntu. I decided to share the files over my wireless network using Samba. My method can compromise network security, so you may want to find an alternative way unless you have a firewall in front of your network as I do. To share, do the following to your server computer:
1. Install Samba by installing the following packages on your server computer: samba and smbfs
2. Go to the folder you want to share under Places. Right click the folder and choose "Share folder."
3. In the dialog box that pops up, choose "Share with SMB"
4. In name, choose a share name--it can be anything you want. Leave the comment field blank.
5. Check "Allow browsing folder" if using Dapper or uncheck "read only" if using Edgy.
6. Click "OK"
7. To make sure that all users have read, write, and execute permissions to the files and subfolders in the shared folder, a couple steps have to be taken. First, type the following in a terminal (I will pretend that your shared folder is /home/Bob):
sudo chmod -R 2777 /home/Bob
(I'm not sure if the sticky bit is needed or not, but it worked and I don't see any harm)
8. Second, we need to set the default permissions for any new files or directories within the shared directory. For this, download two things using synaptic: acl and eiciel. Eiciel is the gui for acl. If you right click on your shared folder, you should have a new tab for access controls. (As a side note, if this doesn't work, try running eiciel with the following command and then navigate to your shared folder: gksudo eiciel)
9. Once you are at the shared folder through the acl tab or the command, you want to click the default acl button and also check the default box. You want to make sure that read, write, and execute is checked for everything.
10. The next step is to do the same for all subdirectories. Eiciel does not act recursively so you have to set the default on all subdirectories by again going to those folders and right clicking and choosing the access control tab or by running the above stated command and then again clicking the default acl button and the default check box.
11. Now we must edit the smb.conf file so type the following in a terminal:
sudo gedit /etc/samba/smb.conf
12. Notice that throughout this file there are headings in brackets such as [Global]. Under the [Global] heading, you will see workgroup=MSHOME. Change this if your workgroup is called something else, otherwise, you can leave it as it is.
13. Next, under the ####Authentication#### section, you will see the following:
; security = user
Remove the semi-colon and change it to look like:
security = share
14. At the bottom of the file, you will see a section under a [ ] heading with your shared folder name. Edit it so that it states the following so that all users on other computers can edit the files:
path = /home/Bob
available = yes
browseable = yes
public = yes
writable = yes
create mask = 0777
directory mask = 0777
15. Save the file and reboot.
16. You can now access these files from your laptop under Places->Network Servers. Find the folder and choose to connect to it.

No comments: