ComTech: IT Support Stirling
TwitterFacebookGoogle

How to configure file sharing on Ubuntu 12.04 LTS

ComTech: IT Support Stirling


Today I will show you how to configure file sharing on Ubuntu 12.04 LTS.  This tutorial works for both the desktop and server variations.

First thing is to install the packages we need – Samba and smbfs. So open up a terminal and type:

sudo apt-get install samba

Type your root password when prompted.  Then install smbfs by typing:

sudo apt-get install smbfs

and then type your root password again.

We now have to configure the smb.conf file which contains all the samba settings. In a terminal type:

gksu nano /etc/samba/smb.conf

Locate the line WORKROUP = WORKGROUP and change it to the name of your network.  So for instance mine would be changed to WORKGROUP = Ubuntu_home.

Now at the end of the file add the following text:

[sdc] (This is the name of your share – change as appropriate)
path = /media/dev/sdc (This is the network path to your share – change as appropriate)
available = yes
browsable = yes
public = yes
writable = yes
comment = shared files

Save the file and exit.

If you prefer GUI’s (Desktop Ubuntu only) then you can install the Samba gui instead and share your folders that way.

Now we have to add users to the smbpasswd file which is located at /etc/samba/smbpasswd.  Only users specified in the smbpasswd file will be able to access your samba shares.  Open a terminal and type:

sudo smbpasswd -a user (where user is the name of the person allowed to access the shares)

When prompted enter their new password twice.

We now need to restart the samba service so in a terminal type:

sudo service smbd restart

Now we have to check the configuration so far.  In a terminal type:

testparm

Testparm will tell you if there are any errors in your configuration.  If everything is Ok then type:

smbclient -L 192.168.1.10 (where 192.168.1.10 is the ip address of your samba server).

This will show you the list of all your available samba shares.  At this point if you have no errors your server is configured correctly.

Linux Clients

Install samba and smbfs either using the package manager or the terminal.  We need to edit the Workgroup field in smb.conf to the name of your network (e.g Ubuntu_home).

Then we have to mount the available shares.  First decide where you are going to mount them.  I will mount them in /media/dev/share but first I will have to make the directory dev so:

cd /media

sudo mkdir dev

and then ls which should show us the new dev directory in media.  Now time to mount the shares.

sudo mount -t smbfs //192.168.1.10/(share name) /media/dev/share where 192.168.1.10 is the ip address of your samba server.  This will mount the share but only as long as you are logged in.  To make the link persistent you need to enter the following line into /etc/fstab.

//192.168.1.10/(share)   /media/dev/share      cifs       username=user,password=pass,user,rw,noatime     0              0

Windows Clients

We have to change the workgroup to Ubuntu_home and then add the ip address of the samba server to the hosts file (must open as administrator).

Once this is complete map the shares to your computer.

Word of warning here about firewalls.  Either turn them off or add exception rules for traffic on ports 137-139 and 445.

About the Author

P1020114

Hi I am Chris Wakefield the owner of ComTech IT Support. I provide Windows and Linux based IT Support, laptop repairs and computer repairs to both business and personal clients throughout Stirling, Falkirk and Clackmannanshire.

For a list of what I can offer you why not visit my website www.comtech247.net where you will find a list of my services, testimonials, blog and much more!!

 

 

13 thoughts on “How to configure file sharing on Ubuntu 12.04 LTS

  1. Chris,
    Thanks for posting this, I have built a NAS on Unbuntu 12.10 which I use to automatically back up my Ubuntu desktop website development machine, now I’d like to also enable auto backup of a windows 8 desktop machine. So your information on Samba setup was very interesting to read.

  2. @ Andrew Boyd. I’m right with you man. Instead of gksu nano /etc/samba/smb.conf

    I was able to get in and edit with sudo nano /etc/samba/smb.conf I am using Ubuntu 12.04 Server. Though I have not gone any farther than changing the workgroup name. I am not sure where exactly to put the rest of the coding. Anybody care to take a screen shot to help out a first timer?

  3. Sir,
    I am using a win-7 operating system in my desktop and it has a wired internet connection and my desktop have two network card and one is shared . I am using a laptop with ubuntu 12.04 operating system and I would like to get this internet shared from this system can you help me to fix the problum of this network with out the help of the rourter, switch or hub. I only want this net to be shared using a network cable.

    With regards,
    Binuraj.R

  4. To be honest I can’t say that I have noticed so I will definitely need to have a look. You could set up Terms and Conditions on your website stating that all material on your site is copyrighted.

  5. With havin so much content do you ever run into any problems of plagorism or copyright violation?
    My website has a lot of unique content I’ve either created myself or outsourced but it seems a lot of it is popping it up all over the internet without my agreement. Do you know any ways to help stop content from being stolen? I’d truly appreciate it.

  6. Amazing blog! Is your theme custom made or did you download it
    from somewhere? A design like yours with a few
    simple adjustements would really make my blog jump out. Please let me know
    where you got your design. Bless you

  7. Andrew when you type gksu nano /etc/samba/smb.conf and open the file use the down cursor key to move down the file.

  8. Dear Sir

    I got to

    We now have to configure the smb.conf file which contains all the samba settings. In a terminal type:

    gksu nano /etc/samba/smb.conf

    Locate the line WORKROUP = WORKGROUP

    where things ground to a halt…

    where would I find the line you mention above? Its certainly not in the terminal window (which I eventually closed as nothing was happening)

    the terminal window had stopped at this stage:

    #
    # Sample configuration file for the Samba suite for Debian GNU/Linux.
    #
    #
    # This is the main Samba configuration file. You should read the
    # smb.conf(5) manual page in order to understand the options listed
    # here. Samba has a huge number of configurable options most of which
    # are not shown in this example
    #
    # Some options that are often worth tuning have been included as
    # commented-out examples in this file.
    # – When such options are commented with “;”, the proposed setting
    # differs from the default Samba behaviour
    # – When commented with “#”, the proposed setting is the default
    # behaviour of Samba but the option is considered important
    # enough to be mentioned here
    #
    # NOTE: Whenever you modify this file you should run the command
    # “testparm” to check that you have not made any basic syntactic
    [ Read 337 lines ]
    ^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
    ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell

    thank you very much

    kind regards

    Andrew Boyd

  9. Chris,
    Thanks to your posting, I was up in less than a minute, (from scratch save the smb.conf file that i pulled from my 11.04 disk.) Hat’s off to you!
    Rich

Leave a comment

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *

CyberChimps
Follow

Get every new post delivered to your Inbox

Join other followers

WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera
WP Like Button Plugin by Free WordPress Templates