Create a Samba Share in Linux

From InebriatedRabbit's Howto Wiki

Jump to: navigation, search

[edit] Debian

First, you will want to install Samba. This step is very easily done by running the following as root:

apt-get install samba

Once this is installed, you need to create a samba share. This is done by editing /etc/samba/smb.conf. When you open this, scroll all the way to the bottom (if you are using vi this can be done with shift+G). There is an example configuration there. The general syntax is as follows:

[sharename]
   path = /path/to/local/directory
   public = yes
   writable = yes

This share would be accessed by \\servername\sharename from Windows and smb://servername/sharename from Linux. However, at this point, anybody trying to access the share would have to enter a valid linux login to access it. Disabling this is a bit of a security risk, in fact on a production server it's a lot of a security risk. On a home network, however, it makes things much easier. You can disable the login prompt by changing the following:

security = user

to

security = share

Once you've added in all the shares you need and saved the file, you will need to restart Samba:

/etc/init.d/samba restart

Congratulations! You've enabled a Samba share.

Personal tools