Vista Hands On #15: Access shared folders from a Linux machine, part 2

Vista Hands On #15: Access shared folders from a Linux machine, part 2

Summary: In the last installment of this series I showed how to quickly (and temporarily) mount a shared folder on a Windows Vista machine from a Linux PC in read-only mode. But what if you want the Vista shared folder to be permanently available to all users, in read-write mode? Here are the step-by-step instructions.

TOPICS: Open Source

In the last installment of this series I showed how to quickly mount a shared folder on a Windows Vista machine from a Linux machine (specifically, from one running Ubuntu 6.10). This solution works if you just want to read files on the Vista PC and you don’t mind re-entering the mount command the next time you reboot your Linux PC. But what if you want the Vista shared folder to be permanently available to all users, in read-write mode?

Here’s how. As in the previous post, these instructions assume that you’ve set up a password-protected shared folder on the Vista machine in a non-domain environment, that you have already installed Samba server v3.0.22 or later and smbfs on the Linux machine, and that you’ve created a Samba user account and password. (For details on how to perform these last two tasks, see Vista Hands On #13: Connect to a shared folder on a Linux machine.) All of the following steps are performed on the Linux machine.

1. Choose a name to use for the shared folder on your Linux machine, such as vista_public. Open a Terminal window and issue the command sudo mkdir /mnt/vista_public (if you chose a different name to identify the shared folder, substitute it for vista_public). This creates a directory that will be used as the mount point for your shared folder.

2. Using a text editor, create a plain text file containing two lines:


Substitute your actual Windows username and password for the italicized text. Save the file in your home folder as .smbpasswd (don't forget the dot at the beginning of the filename, which makes the file hidden). Finally, change the permissions on the file so only you can open and change it by issuing the following command in a Terminal window:

chmod 600 .smbpasswd

3. On the Linux machine, open /etc/fstab in a text editor. (On Ubuntu, I used the command sudo gedit /etc/fstab. You can use another editor if you prefer.)

4. At the end of the file, add a new line containing the following:

//vista_pc_name/share_name   mount_folder_name smbfs credentials=/home/linux_username/.smbpasswd,uid=linux_username,gid=users  0 0

Use the UNC path for the Windows share, and replace mount_folder_name with the full path of the folder you created in Step 1 (in this example, /mnt/vista_public). Substitute your Linux username for the values in red. These credentials will be passed to the Vista machine. (Note: there’s no space after the comma and before the uid and gid.) [Update: Thanks to Jeremy Allison in the comments of the previous post for pointing out that smbfs is deprecated and no longer maintained. You can safely substitute cifs for smbfs in the fstab entry.] 

5. Save the file and, in the Terminal window, issue the command sudo mount -a.

6. Create a link in your Home folder or on the desktop to the location you created in Step 1 (in this example, /mnt/vista_public) and give the link a descriptive name. Click OK to save it.

You now have a shortcut (link, in Linux-speak) that you can use to to access files in your shared Vista folder. If you find that subfolders in the shared folder are set as read-only, right-click the folder on the Linux box, choose Properties, and click the Permissions tab.

For more details, read this excellent tutorial at, which was one of my primary sources for getting up to speed on these features.

Topic: Open Source

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
  • Good Article


    You should consider putting these articles into a Linux for Windows users book or something. Something for the Windows user who might wish to experiment with, connect to, or use Linux.

    While I haven't always seen eye-to-eye with some of your stories, I find these articles quite informative and easy to follow.


    The Banjo
    • there's one

      from oreilly that handles most of this stuff, it's calles "linux in a windows world".

      Though it tends to be pretty technical, it sure will help out (especially in an enterprise environment).
      • Thank you (nt)

        The Banjo
  • Another variation...

    .. on this theme is to place the details in /etc/samba/smbfstab which is NOT world readable by everyone. A default smbfstab looks like

    # This file allows you to mount SMB/ CIFS shares during system
    # boot while hiding passwords to other people than root. Use
    # /etc/fstab for public available services. You have to specify
    # at least a service name and a mount
    # point. Current default vfstype is smbfs.
    # Possible vfstypes are smbfs and cifs.
    # service moint-point vfstype options

    //fjall/test /data/test cifs username=tridge,password=foobar
    • I agree

      I prefer this method as well, though I prefer when i'm asked for a username and password, (for those cases I'm away from my computer).
  • Very Nice

    He's starting to get the hang of it. Way to go Ed.
  • Forgot one more thing

    You know that Jeremy Allison is the lead developer at the Samba project, right?

    Another example about the open source community. He took the time out to post the information on your blog. You should do an interview with him as part of the article series. I'm pretty sure he'll do it.
  • Hey Ed!

    Glad to see you are using the Just Linux link I provided for you back when you started your foray into Linux. So question is this, granted you have only a short amount of time with the penguin, what is your opinion so far?

    Inquiring minds would like to know! ]:)

    PS: Keep having fun!
    Linux User 147560
    • Still too early

      I have some first impressions, but so far am pleased at the way I've been able to get things to work the way I want them to.

      Also, let me just do a level set of expectations here: I'm a Windows expert. It's what I do for a living, so my goal isn't to switch to Linux. It's to document the interop issues in a world where Windows and Linux are increasingly going to coexist. I find that many Linux experts have a "Microsoft sucks" attitude that means they're unwilling to even consider a world where both OSes exist. And most Windows experts are content to stay in a world where everything is from Redmond (with occasional visits to Cupertino). That means it's very hard to find information about Linux that is accessible and understandable to people who are comfortable in a Windows world.

      So I'm trying to bridge the gap, but I anticipate that I will continue to use Windows Vsita as my main desktop OS.

      (And Harry, if you're listening, I will probably be adding some mac hardware to the equation sometime in the summer, after Leopard is released. No promises, though.)
      Ed Bott
      • And I ...

        Work primarily in a LINUX environment but, but with 30+ years experience realize ever OS has it's place. Yeah, sure I say "WINBLOWS" or "MICROSUCKS", but it's mainly 'cause of their current business practices / activation schemes and other ways to get DEEP into your pocket.

        I have entriely LINUX based companies (including desktops), Some with a mix *NIX and Windows, Some with MORE Windows and one or 2 Linux boxes and others ALL windows. I do AD / Server setup in Windows world as well as the same in the Linux world.
      • Ease up on the Generalizations!

        I am an absolute Linux Junkie (junkie, not expert; but getting there).

        I don't hate Microsoft, Bill Gates, Windows, or anyone who prefers them. I do have a particular dislike for OS preferences so strong that it becomes a religion with faith exceeding that of what really should be important (God, Family, Country, whatever floats your boat).

        In my office I have desktops/laptops/servers running 98, 2000, XP, Linux, dual-booting XP/Linux, OSX, and dual-booting OSX/Linux. They all play nicely together in all environments. None is truly "better" than the rest. It is a matter of preference.

        It seems so far that you would agree: People who put politics ahead of practicality need to have their heads examined and are only hurting themselves by wearing a shoe that doesn't fit. The sad fact is the number of people who refuse to try on the other shoes!

  • Ed, Have You Tried Beryl Yet?

    Seems really promising, and it gives you nearly the same experience as you get in Mac or Vista...
    • No, I haven't

      At this point, it's not an interop feature, and that's my focus.
      Ed Bott
      • C'mon Ed

        You know you want to at least try Beryl. Deep down your a computer fanatic just like the rest of us and that eye candy is just too tempting.

        Come to the dark side, we have cookies!!!
        • Oh, I will...

          Just want to get a good solid grounding in the basics first.
          Ed Bott
  • Have been sharing from Fedora for a while now

    Kudos to Ed for "sharing" his experiences.

    I don't have to jump through as many hoops as Ed seemed to have done and set up the Samba shares through the Red Hat graphical tools.

    I'll just have to remember what I did!

    Linux is great for my media server - but I still use WindowsXP as my main desktop - I have to support users!!!!!!

    The Samba share is transparent to them - it just looks like it was a drive in their normal Windows envo
    • Never used SMBClient before

      I've been installing and using Samba as Windows file servers, FAX servers and print servers for years, but until Ed started this series, I had never attempted to view a Windows share from a Linux box.<br><br>
      Thanks Ed! Today, due to the spark from your editorial tinkering, I set up one of my Samba boxes to pull my backups from a Windows based Server into my Linux box. Previously, I had been pushing them to the Linux box manually when I did my backups. Now I don't have to stay late on Friday evenings!
  • Have your tried smb4k?

    It's a nice KDE GUI app for Samba shares browsing and connecting.

    Excellent article, BTW!
    • workgroup reliability

      smb4k is very handy for people who are used to browsing the Network Neighborhood in Windows. The problem is that the 'net 'hood relies on one computer in the workgroup to keep a running list of all computers and their hostnames and the job doesn't always get done very well, indirectly rendering Network Neighborhood and smb4k largely unreliable (I can't tell you the number of times I have changed a machine's hostname and had it appear in the 'hood twice, one of them being the old hostname on an icon that doesn't work). As I said in my post a few minutes ago, any machine that needs to reliably act in any type of server capacity should be given a static IP and connected to via that, not its hostname.

  • A question about NTFS

    If memory serves there are several patents concerning NTFS. How is it Linux is able to pretend the patents don't exist and read/write NTFS files? Isn't this something that is waiting to turn around and bite users in the backside. (Unless we are talking Novell of course.)