Official website for Linux User & Developer
FOLLOW US ON:
Jul
27

Build a Samba file server

by Sukrit Dhandhania

How to build your own file server using Samba and Ubuntu with help from Linux User & Developer veteran, Sukrit Dhandhania…

04 Basic configuration
When you have opened the file, scroll down a bit and look for a section called ‘Authentication’. This section will have a configuration area that looks like the following:

# “security = user” is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
#   security = user

Comment out the ‘security = user’ bit by removing the ‘#’ or ‘£’ at the beginning of the line. What this setting change does is that it now allows users registered on the Linux system to log into the Samba server using their username.

05 Workgroup
Another thing that you might want to change, depending upon how your current network is set up, is the workgroup settings of your Samba server. Look for the following line:

# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = WORKGROUP

If you already have a workgroup set up, or are in a network with a Windows Server, you can change the workgroup setting from ‘WORKGROUP’ to whatever is being used currently on your network. Alternatively you could set something new and start a new workgroup for your network. MS Windows-based networks often use the workgroup ‘MSHOME’.

06 Start Samba
At this point you can save the Samba configuration file, ‘smb.conf’, and restart the Samba service. This can be done in several ways. If you want to use the command-line interface, execute the following command:

# sudo /etc/init.d/samba restart

After you restart Samba, you should be able to see your Ubuntu computer in the network share of other computers that are on the same network and in the same workgroup. On a Windows computer it should be visible under the Network Neighborhood. Next, we are going to begin creating some shared directories.

07 Create a common share directory
The first type of shared directory that we will create is going to be a network storage location where people can log in and access the data stored there without authentication. They will be able to download files, but not write to the location. So the configuration of this directory has to be done so that the location is read-only, the users should be allowed to access it without authentication, and we’ll also grant users the permission to browse through the contents of this directory.

So create a new directory somewhere in the Samba server’s hard drive. We chose the location ‘/opt’ for such directories, but you may choose some other location if you like. After creating the directory, you need to set the permissions for it:

# sudo mkdir -p /opt/commonshare1/
# sudo chown -R root:users /opt/commonshare1/
# sudo chmod -R ug+rwx,o+rx-w /opt/commonshare1/

Add a dummy file in the directory so that we find something to view when we run a test for this shared directory:

# sudo echo “hello world” > /opt/commonshare1/hello.txt

Next Page

twitter follow us
Pages: 1 2 3 4 5 6
  • Tell a Friend
  • Follow our Twitter to find out about all the latest Linux news, reviews, previews, interviews, features and a whole more.

    2 Comments »

    • jkneb said:

      Hi, great article, very instructive.

      And what about accessing the samba share from outside of the network ? Let’s say I’m at work and I would like to access my samba share wich is on my home network IP adress.

      Any idear ?

      Again great article :)
      Cheers
      Julien

    Trackbacks

    What's your opinion?

    Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

    Be nice. Keep it clean. Stay on topic. No spam.

    * Required fields