Vista Hands On #14: Access shared folders from a Linux machine, part 1

Vista Hands On #14: Access shared folders from a Linux machine, part 1

Summary: Last week, I explained how to create a connection on a computer running Windows Vista to access a shared folder (or directory) on a Linux machine. Today, I show how to connect from a Linux machine Linux machine to a shared folder on a PC running Windows Vista. Changes in the architecture of Windows Vista make it more difficult to connect to Vista shares from Linux machines, but there are some straightforward workarounds.

TOPICS: Windows

Last week, I explained how to create a connection on a computer running Windows Vista to access a shared folder (or directory) on a Linux machine. Today, I show how to connect from a Linux machine to a shared folder on a PC running Windows Vista. These instructions assume that you have already installed Samba server v3.0.22 or later and smbfs on the Linux machine and created a Samba user account containing your credentials. (For details on how to perform these tasks, see Vista Hands On #13: Connect to a shared folder on a Linux machine.) They also assume you’ve set up a password-protected shared folder on the Vista machine and that you’re running in a non-domain environment.

Changes in the architecture of Windows Vista make it more difficult to connect to Vista shares from Linux machines. If you browse the network from Linux (network:///), you can see other machines, including those running any version of Windows. If you double-click the icon for a computer running Windows XP, you can see a list of shared resources on that computer. You can also connect to those resources if you have the correct password. But if you try the same thing with a computer running Windows Vista, you’ll find yourself unable to view the shares, much less connect to them.

Fortunately, there are a couple of workarounds.

For quick access to a shared folder on a machine running Windows Vista, first create an empty folder in your Home directory, using a name that describes the shared files. Next, open a Terminal window and enter the following command, all on one line:

sudo mount -t smbfs -o username=windows_username,password=windows_password
//vista_pc_name/share_name   mount_folder_name

Substitute your Windows username and password for the values in red. Use the UNC path for the Windows share, and replace mount_folder_name with the full path of the folder you created (in my case, I created a folder called shared_vista, so the path I used was /home/edbott/shared_vista). Be sure not to add a space after the comma and before the word password.

[Update: Thanks to Jeremy Allison for pointing out in a comment that smbfs is deprecated and no longer maintained. You can safely substitute cifs for smbfs in the command line above.] 

This technique works fine for quick access to shared files on a Vista machine, but there are two limitations. First, the mounted folder isn’t persistent. If you restart your machine, you’ll have to execute the mount command again to gain access to those shared files. Second, access to the Vista folder is read-only. That’s fine if you just want to copy some files from your Vista machine to the Linux box, but it’s a nuisance if you want to go the other direction.

In that case, there’s a workaround, which you’ll find in the next installment of this series, Vista Hands On #15: Access shared folders from a Linux machine, part 2.

Topic: Windows

Kick off your day with ZDNet's daily email newsletter. It's the freshest tech news and opinion, served hot. Get it.


Log in or register to join the discussion
  • Exciting!

    This is great Ed. Your one of the few who are writing instruction and tips on inter operating Vista and Linux. It goes without saying too with the MS Novell deal.

    In fact, I don't see where much has changed yet? Samba development has always worked pretty much the same. MS just doesn't hand over the source code and how it all works to the Samba development team. The fact is that much work has to be done to figure out what works different in Vista networking. The Samba client GUI's will update behind Samba and also the KDE, Gnome desktop integration.

    For example, Konqueror will search for Samba shares on XP PC's. Or type in the path: smb://your_workgroup. Creating a link on your Linux desktop to a smb mount will Auto Mount when you restart.

    I haven't worked much with Vista yet because the hasn't been the need. But I expect Samba to work just as well with Vista as it does with XP in the very near future.

    Lastly, What's important here is the education the new to or first time Samba network administrator is getting. Using the mount, chmod,chown,smb client, commands give a deep understanding of how a Server Message Block network works. Ubuntu has has great documentation as well as Samba. Samba by example is very helpful. I really could go on and on LOL! but I'll let you write and I look forward to reading your hands on.
    • What's changed...

      Thanks for the kind words.

      There was a big change between XP and Vista. On a Linux machine, I can browse directly to shares on an XP box. In Vista, I cannot enumerate them at all.

      If I type smb://workgroup I can see the computer icons, but trying to open a Vista machine to view available shares fails every time. The only way to make the shares visible is using the mount command (either interactively or in /etc/fstab).

      I'm still researching why the shares won't appear.
      Ed Bott
      • I take it that you have set up the SAMBA workgroup?

        In the GLOBAL section of /etc/samba/smb.conf

        • Yes

          Alas, it makes no difference.
          Ed Bott
      • Use CIFSFS not smbfs


        You're using a deprecated kernel module (smbfs). I know, I know, it's still shipped because there are some circumstances you might need it to get access to older Windows shares (Win9x), and the documentation saying what to use as a replacement probably sucks (I haven't looked).

        But I'd recomment using mount.cifs instead. Works out of the box for me :

        mount.cifs //<vista-name>/<sharename> /mnt -ouser=<vista-username>,pass=<vista-password>

        • Does it work on Vista?

          "Works out of the box for me"

          On Vista? Your post implies that but I just want to make sure you've tested it.

          There was no reference anywhere to CIFS in any of the documentation I surveyed. Not even a hint, or I would have gladly followed it.
          Ed Bott
          • Works mounting the vista share onto the Ubuntu box.

            This works out of the box for me mounting the Vista box as a server onto a directory (/mnt in the example I used) on the Ubuntu box (6.10). It's Steve Frecnh's CIFSFS client, which is the replacement for smbfs. smbfs is no longer maintained, CIFSFS is the in-kernel module to replace it.

          • Thanks Jeremy & Ed...

            ... Thanks to Ed for running this blog and giving Jeremy the chance to make the CIFS statement.

            That needs to be advertised more widely!
          • Many thanks, Jeremy

            I've found the Samba wiki and am learning some useful stuff there. Thanks for the pointer and suggestion.
            Ed Bott
          • Glad to help.

            If you've got further questions you'll find the mailing list very helpful also.

        • mount.cifs is not available in Fedora Core 6

          I have samba running fine within our SBS2003 domain but am interested in connecting to a Vista share the "EASY" way. I cannot access mount.cifs as a user, sudo or su.

          Is there a release number for the SAMBA package that includes this newer kernel module?
          • Found CIFS in smb4k but not CLI

          • CIFSFS is not a Samba package - it's a kernel package

            It's a kernel module, released as part of the normal kernel modules via the Linux vendor. Samba supplies the "mount.cifs" utility that can invoke it (just as we provide the smbmount utility for smbfs)
            but CIFSFS isn't part of Samba.

          • Kernel Versions

            I just checked a FC6 machine I have here at my office. It fully supports mounting CIFS. It's not up to date, because I haven't used it in a while, but it's definitely newer than the original kernel and Samba binaries on the CDs or DVD.<br><br>
            Kernel 2.6.19-1.2911.fc6<br>
            samba-common 3.0.24-1.fc6<br>
            samba-client 3.0.24-1.fc6
    • Deep Agreement with xstep

      This is an excellent set of articles.

      One suggestion: besides giving the grammar for a particular command, it's very useful if you give an example using actual paths and UNCs. Such examples will flesh out holes in any grammar description.

      Anyways, this is great. Linux continues to evolve quickly and smartly. Networking it with Windows and Mac machines on mixed networks must be made easy. First step to easy is just getting it to work.

      Thanks Ed.

      -- stan

      - - - - - - - - - - - - - - - - - - - - -
      Stanley Krute Computer and Photographic Services
  • Thanks Ed

    You are creating a situation where people will not be defined individually by the OS they choose. there are too many people on here that say be this or be that and what you are doing is showing that there is a middle gound. Thank you Ed

    I dual boot
  • Where do I find this

    "sudo mount -t smbfs -o username=windows_username,password=windows_password
    //vista_pc_name/share_name mount_folder_name"

    Where do I find this in the GUI?
    • Depends on the GUI ...

      In Gnome you would open the Nautilus File Browser and then from the File menu select Connect to Server. Choose "Windows share" for SMB in the dialog that opens.


      • Will that work with a Vista machine?

        I don't have that distro installed, obviously, but I found that I could use the GUI to access a share on an XP machine and could not do so on Vista. If you're speaking from personal experience WITH VISTA, please let me know.
        Ed Bott
    • Seeing as there is no unified GUI

      there is no one GUI solution, so people who use GNOME would have a different GUI solution than people who use KDE. However the CLI solution works across the board, so I am sure this is why Ed chose to give that solution.

      Webmin has a pretty good GUI solution that works with any popular GUI web browser. I don't ahve it in front of me, but going off of memory you would go into the system tab and select the mounts icon (or something like that), then from a dropdown menu select smbfs mount and click add. Then just take the info provided above and place it in the relevant fields. Also if you use KDE I know Konqueror has a networked folders tab amongst its many sidebar tabs which I've used with ease with XP shares, though I would think that since its just a front end to Samba that it would work with Vista as long as you have the correct version of Samba. I am not familiar enough with GNOME to give you its stock solution.
      Michael Kelly