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
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.