Share folders via Samba without a password - easy!


Coming from the Windows world to Linux, one of the first things I wanted to do was to share directories on Ubuntu with my Windows laptop to easily transfer files. In Windows I can just right click a folder, go to sharing, and enable it. No users and passwords to set up. It goes without saying that this is not secure and you want to be careful doing it, but it’s a great way to share files between computers at home. Here’s how…

Sadly, it’s not yet that easy to do this in Ubuntu (let me know if there’s a simple way to do it with other distros). Ubuntu makes it easy to install the samba server. If it’s not already installed, you can right click on a directory and try to share it. It will ask you to install samba. You can also use

sudo apt-get install samba

or via the add/remove programs under the application menu.

Ubuntu, however, isn’t able to set it up for anyone to access without logging in, yet. It will only share with a login and password. So, to do this you’ll need to edit your /etc/samba/smb.conf file. Here’s how share a folder without a password or login:

  • 1. In a terminal type
sudo gedit /etc/samba/smb.conf

(kubuntu users type kdesu kate /etc/samba/smb.conf)

  • 2. Find the ### Authentication ### section (might be called Administration in older versions of Samba), where it says security = user
  • 3. Change it to
security = share

and make sure the line does not start with a semicolon. If it does, remove it.

  • 4. A few lines down from that you’ll see
; guest account = nobody

Remove the semicolon at the beginning of the line.

  • 5. Scroll to the very bottom of the file and put in the following, adjusted for your own system
[Share name]
writable = yes
path = /path/to/directory
public = yes
guest ok = yes
guest only = yes
guest account = nobody
browsable = yes
  • 6. Save the file and quit gedit
  • 7. In the terminal restart the samba server to reload the conf file
sudo /etc/init.d/samba restart

That should do it. If you want to try a more sophisticated way to configure shares, there is a GUI application called gsambad. I’ve found it overkill for just doing a simple share, but for others it might be quite useful. In Ubuntu you can download it from add/remove programs.

Enjoy!


 
linux/samba2.txt · Last modified: 2008/11/25 17:30 (external edit)