Sunday 26 September 2010

Installing Samba on Ubuntu 10.04

1. Installation


The first step is to install the samba package. From a terminal prompt enter:

sudo apt-get install samba

That's all there is to it; you are now ready to configure Samba to share files.


2. Configuration

The main Samba configuration file is located in /etc/samba/smb.conf. The default configuration file has a significant amount of comments in order to document various configuration directives.


Not all the available options are included in the default configuration file. See the smb.conf man page or the Samba HOWTO Collection for more details.


First, edit the following key/value pairs in the [global] section of /etc/samba/smb.conf:


workgroup = EXAMPLE

...

security = user

The security parameter is farther down in the [global] section, and is commented by default. Also, change EXAMPLE to better match your environment.



Create a new section at the bottom of the file, or uncomment one of the examples, for the directory to be shared:



[ananta_samba_server]

comment = Ubuntu File Server Share

path = /home/ananta

browsable = yes

read only = no


comment: a short description of the share. Adjust to fit your needs.

path: the path to the directory to share.


browsable: enables Windows clients to browse the shared directory using Windows Explorer.

read only: determines if the share is read only or if write privileges are granted. Write privileges are allowed only when the value is no, as is seen in this example. If the value is yes, then access to the share

3. There are two steps to creating a user. First we’ll run the smbpasswd utility to create a samba password for the user.




sudo smbpasswd -a



Next, we’ll add that username to the smbusers file.



sudo gedit /etc/samba/smbusers



Add in the following line, substituting the username with the one you want to give access to. The format is = “”. You can use a different samba user name to map to an ubuntu account, but that’s not really necessary right now.



= “

ex.
ananta='ananta'

--------------------------------------------------------------------------------





Where is /etc/init.d/samba in 10.04?




Two things have happened - "upstart" has replaced the old way of starting services and the "samba" service has been replaced by the old way of separating the smbd and nmbd daemons.


So the way you need to restart samba is now this way:


sudo service smbd restart

sudo service nmbd restart


Samba installation is done. Go to Windows , to Map Network Drive
file://ip/ananta_samba_server

:)