Ubuntu – Ubuntu 14.04 lts <-> Windows 7 sharing

sambasharingwindows

I'm pretty much a newbie with UNIX and I m having a bit of a difficulty connecting my Ubuntu PC with my Windows 7 PC via LAN.

First things first, I've installed samba and created a shared folder both via CLI and GUI and everything seams to be working.

On my windows PC I've set up all the network settings as they should be in Control Panel -> Network and Sharing center -> Advanced sharing settings.

Network sharing is working with my windows laptop and my Windows desktop but the Ubuntu laptop is not visible in my network list and my Windows pc's cant see my Ubuntu laptop on network either.

I'll upload my smb.config file once I get in my Ubuntu laptop so you guys can see that as well i just wrote this first in case i'm forgetting to do something to make this work.

And yes, both my Windows PC's and Ubuntu PC are in the same workgroup.

Best Answer

  • In order for Ubuntu and Windows 7 to share files, they have to be configured to be part of the same Workgroup. Also, file sharing needs to be enabled in Ubuntu.

    Install the Sharing Service in Ubuntu Linux

    The sharing service or Samba as it is called in Ubuntu is not installed by default. The installation process of Samba varies in complexity depending on the method you will be using. I will show you the most easy and straightforward method to install Samba.

    First, in Ubuntu, open the Home Folder, located in the Places menu.

    Next, right-click on any folder from this window to open a contextual menu. From the contextual menu, click on Sharing Options.

    This opens the Folder Sharing window. Check the box next to ’Share this folder’.

    A warning window will pop-up stating that the sharing service is not installed. Click on the Install service button.

    Note: If you do not receive this warning, it means that the sharing service is already installed and you should be able to share files and folders. To change the Workgroup, follow the instructions found in the next section.

    Then type your user account password and click on OK. The installation process will begin.

    In a few seconds, you will be notified that all changes have been successfully applied. Click Close and Ubuntu will ask to restart your session.

    Save any open files you might have and click Restart session. After the restart, the sharing service is installed and fully functioning.

    Configure and change the Workgroup in Ubuntu

    In most cases you won’t have to change the Workgroup name because, by default, Ubuntu, Windows and Mac OS X have the same Workgroup name, which is actually “workgroup”. However, if you have to change it follow the steps detailed in this section.

    Open a Terminal window and type the following command: gksudo gedit /etc/samba/smb.conf.

    Then, press Enter. If you haven’t previously used the Terminal this session, Ubuntu will ask you to type in your user account password.

    Next, the Samba configuration file will open in a gedit window. Scroll down, if necessary, until you find the workgroup line, in the Global Settings section.

    enter image description here

    Edit the Workgroup name so that it will match the name of the Workgroup you want to add your Ubuntu computer to.

    Click on Save and restart Ubuntu so that the new settings get applied.

    Note: If you have a network which includes Windows computers, you need to make sure the Workgroup is set up the same as on your Ubuntu computers.

    To Share Files in Ubuntu

    First, open the Home Folder in Ubuntu, found in the Places menu.

    Browse to the folder you want to share. Right-click on it to open the contextual menu and click on Sharing Options.

    The Folder Sharing window will open. Check the box next to ’Share this folder’. Then, in the Share name field, type the share name you want to use. In the Comment field type anything you want or just leave it empty - there’s no need to complete it. If you want to allow others to create and delete files in the folder you are sharing, check the box next to ’Allow others to create and delete files in this folder’. Also, if you want to allow Guest access, check the box next to ’Guest access (for people without a user account)’. When done, click on Create Share to actually share the folder.

    If you have selected the option ’Allow others to create and delete files in this folder’ a pop-up shows up, asking if you want to add some permissions to the folder you are sharing. Click on the ’Add the permissions automatically’ button. Now, the folder is shared with the rest of the network.

    Note: We recommend that you only share folders found or created in the Home Folder because those are folders on which your username has ownership. If you try to share a folder outside the Home Folder, you will receive the following error message: net usershare returned error 255: net usershare add: cannot share path as we are restricted to only sharing directories we own. This error appears because you don’t have ownership on those folders. In order to share any of them you have to go through a complicated procedure that has the potential to add security risks to your Ubuntu computer.

    Access Ubuntu Shared Folders from Windows 7

    After you shared a folder in Ubuntu, let’s see how to access that folder from a Windows 7 computer.

    Open Windows Explorer. Click on Network to view a list with all computers available (turned on at that time) in the network.

    Double click the Ubuntu computer you want to access. A list with all the shared folders and devices from that computer opens.

    Double click the folder that you want to access. If you haven’t set up the shared folder to allow Guest access, you are asked to introduce a user name and password.

    In the first input field, type the name of the Ubuntu computer followed by a backslash (“\") and the name of the user account with access to the shared folder. In the second input field type the password. If you want Windows to remember your user name and password, check the box next to ’Remember my credentials’. When done, click on OK.

    Now the content of the shared folder is shown.

    Reference: http://www.7tutorials.com/how-access-ubuntu-shared-folders-windows-7

  • Related Question