On The Insider: Robert Pattinson's New Leading Lady
BNET Business Network:
BNET
TechRepublic
ZDNet

April 3rd, 2007

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

Posted by Ed Bott @ 4:00 am

Categories: Tips, Windows Vista

Tags:

In Focus » See more posts on: Vista, Hands on Vista

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:

username=windows_username
password=windows_password

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 justlinux.com, which was one of my primary sources for getting up to speed on these features.

Ed BottEd Bott is an award-winning technology writer with more than two decades' experience writing for mainstream media outlets and online publications. See his full profile and disclosure of his industry affiliations.

Email Ed Bott

Subscribe to Ed Bott's Microsoft Report via Email alerts or RSS.

  • Talkback
  • Most Recent of 54 Talkback(s)
Does that affect on smb4k?
I'm using smb4k and I have access (as user or root) to all shares except one. That share is mounted and is visible on the right side of smb4k window along with other shares. When I press it to enter, ... (Read the rest)
Posted by: Gojkovic Posted on: 08/27/07 You are currently: a Guest | | Terms of Use
Good Article  BanjoPaterson | 04/03/07
there's one  tombalablomba | 04/03/07
Thank you (nt)  BanjoPaterson | 04/03/07
Another variation...  bportlock | 04/03/07
I agree  tombalablomba | 04/03/07
Very Nice  MisterMiester | 04/03/07
Forgot one more thing  MisterMiester | 04/03/07
Hey Ed!  Linux User 147560 | 04/03/07
Still too early  Ed BottZDNet Moderator | 04/03/07
And I ...  Linux_4u! | 04/03/07
Ease up on the Generalizations!  litljay | 04/04/07
Ed, Have You Tried Beryl Yet?  itanalyst | 04/03/07
No, I haven't  Ed BottZDNet Moderator | 04/03/07
C'mon Ed  MisterMiester | 04/03/07
Oh, I will...  Ed BottZDNet Moderator | 04/03/07
Have been sharing from Fedora for a while now  pingu@... | 04/03/07
Never used SMBClient before  Webmoron99 | 04/03/07
Have your tried smb4k?  GreyGeek | 04/03/07
workgroup reliability  litljay | 04/04/07
A question about NTFS  No_Ax_to_Grind | 04/03/07
Not reading/writing to NTFS  Webmoron99 | 04/03/07
Thank you!  Tony Agudo | 04/03/07
Did you notice the publication date...  Webmoron99 | 04/03/07
Yes I did...  Tony Agudo | 04/04/07
Ummm, not true  No_Ax_to_Grind | 04/06/07
Have you been paying attention?  MisterMiester | 04/06/07
Not the Microsoft implementation  MisterMiester | 04/06/07
Not related to Samba, but  D-cat | 04/04/07
Samba is not NTFS implementation  DannyO_0x98 | 04/04/07
However  No_Ax_to_Grind | 04/06/07
No you don't because ...  MisterMiester | 04/06/07
Not the Microsoft implementation  MisterMiester | 04/06/07
OT: but what the heck  litljay | 04/05/07
Windows Shared Directories  rchasse2002 | 04/03/07
Go back and read post #13 in this series  Ed BottZDNet Moderator | 04/03/07
Just because it can be done  TonyMcS | 04/03/07
He's not doing it "just because it can be done"...  Tony Agudo | 04/03/07
Technobabble?  Webmoron99 | 04/03/07
Technobabble?  MisterMiester | 04/03/07
One small warning about Samba and connectivity.  D-cat | 04/04/07
never seen it  litljay | 04/05/07
Never seen it either  bportlock | 04/05/07
Never a problem with a server,  D-cat | 04/05/07
Nothing wrong with your way, but it won't always work...  litljay | 04/05/07
100% in agreement  D-cat | 04/06/07
Does that affect on smb4k?  Gojkovic | 08/27/07
Easy to fix  MisterMiester | 04/04/07
Hmmm, never used a "-9"  D-cat | 04/04/07
Switch -9 kills everything  MisterMiester | 04/04/07
Additional information  MisterMiester | 04/04/07
Don't do that.  JeremyAllison | 04/04/07
Thanks Jeremy  MisterMiester | 04/04/07
Great info!  xstep | 04/04/07
Make it available to all users!  litljay | 04/04/07

What do you think?

SponsoredWhite Papers, Webcasts, and Downloads

Click Here
advertisement

Recent Entries

advertisement

Archives

ZDNet Blogs

White Papers, Webcasts, and Downloads

Enterprise Applications

  • Check out some of the easiest and most powerful ways to boost productivity while saving money on your application infrastructure. See ZDNet's comprehensive Enterprise Application resource center, now!
  • New Online Dashboard
  • Read about top issues IT decision-makers face every day, plus get cost effective solutions to real life IT problems. Oracle Topline