Setting up Samba server on Ubuntu

This is a quick instruction on how to install Samba (CIFS / windows share) on a Ubuntu system.   This basic setup works on Ubuntu 8.x to 11.04 and presumably subsequent versions.

The information in this post is mostly extracted from a post on another site.   I wanted to collect all the information necessary for putting together my NAS project in one place.  Installing Samba Server:

sudo apt-get install samba smbfs;
emacs /etc/samba/smb.conf;  (or use vi/gedit or your own editor)
  • Comment (prepend #) the lines in the [printers] section including the [printers] line
  • Same (comment) section [print$]
  • At the bottom of the file, create a section for each of the disk / partition that you want to share.   Here is what it should look like:
  path = /mnt/mydisk/someDirToExport
  available = yes
  valid users = My_USERNAME
  read only = no
  browsable = yes
  public = no


  • myraid5 is the “share name” (mount on client w //NAS_HOST/myraid5 )
  • path:  directory you want to export
  • available:  yes/no   – no: SHARE temporarily unavailable for export
  • valid users:  who can mount this share
  • read only:  yes/no   – no: implies read/write access
  • browsable:  yes/no – yes: allows client to browse available SHARES on this host
  • public:         yes/no – yes: gives access to guests
sudo smbpasswd -a USERNAME; (sync this passwd w linux host passwd)
sudo restart smbd;
sudo testparm;  (shows basic smb config and exports)
   # It also confirms that the samba server is up and running

Now you can access is from another computer.

Mounting Samba or windows share from Ubuntu desktop:

sudo apt-get install samba smbclient smbfs

You can mount a windows or samba share using the gui or by editing the /etc/fstab file.  To use the GUI,  got to “Place–>Connect to Server…”

Select “Windoww share”

Enter server name (or IP address)

Enter the share name (test123 above)

the username you configured on the SAMBA server

If you leave the Domain Name empty, it will assume the default WORKGROUP which should also be the default on the SAMBA Server.

Click “Connect” and a popup window will ask for your password (on the samba server).

Mounting using the command line:

sudo mkdir /media/myraid5   (choose your own mount point)
sudo emacs /etc/fstab

Add this line to the file:  (using your own server/share/username/password)

// /media/myraid5  cifs username=scoob,password=XXXX,iocharset=utf8,file_mode=0777,dir_mode=0777

Then mount the share:

sudo mount /media/myraid5

And you should now be good to go!   Of course there are many tweaking,  special configuration setup which you can feel free to explore.   This gives you a solid working setup to work with.




About admin

My name is Christian Marcotte. I live in San Diego with my wife Carolyn and our son Jeremiah. This site is a recording of my currrent ponderings, hobbies and interest.
This entry was posted in Linux, Software. Bookmark the permalink.

2 Responses to Setting up Samba server on Ubuntu

  1. Eddy says:

    Hi Christian,

    Thank you for sharing. I was also considering getting DS211j for my home, but i felt that I needed more than only 2 HDD, yet i think paying for higher end NAS for my home is little bit above my own personal budget.

    Anyway, I am so moved by your blogs here.

    I am not familiar with text based Linux. I noticed that you set a lot of parameters using text based (sounds complicated, especially on Setting the RAID).

    So my question is: how difficult is it for me (whom does not have any solid Ubuntu experience) to setup (setting) this DIY powerful NAS? I am concern particularly in setting up the raid procedures.

    What do you think?

    • admin says:

      Hello Eddy.
      I would offer you three suggestions:

      1. DS411J goes for $360 (today) on Amazon: You can’t build your own for cheaper than that
      2. Get a ubuntu server book (ubuntu server is the same software but without GUI so a server book will give you a lot of command line info) along with some linux for dummy book and give it a try. You don’t have to buy a new computer to try it. Just make a new partition (dual boot) on a home pc (or better yet, use an old home pc). If you want to try the raid and such, the cheapest way is to get one of those neat rosewill raid boxes (the 4 or 5 disks) recommended in the article. They come with a linux compatible e-sata card. You try my blog instructions and see if that works for you.
      3. If you want simpler with a nice GUI, you can try Free NAS. I tried it a number of years ago and fount (at the time) the hardware compatibility list to be very limited (and poorly documented).

      Good luck!
      – Christian

Leave a Reply

Your email address will not be published. Required fields are marked *