[ # ] Mount any Windows Folder on Linux Using Samba
/* Posted May 23rd, 2008 at 10:24am *//* Filed under Linux, Windows */

If you’re like me an have to develop in both Linux and Windows platforms, sometimes it’s just useful to be able to share folders across your PC desktop and your Linux box. It’s quite easy to map Linux shares to Windows network drives, that is assuming your Linux box has Samba installed. In most cases, Linux distributions generally ship with this already installed. To test if you’ve got Samba installed on Linux, type:
smbclient -L <windows-box> -U <username>
If this is true, you can proceed to map the Linux share to Windows. On the Windows DOS prompt (or in Start->Run…) type this command:
net use H: \\linux-box\home\user
Alternatively you can also do this graphically by clicking Tools->Map Network Drive on any Windows Explorer window and filling out the fields with similar information though remember to supply your Linux log in credentials if it’s different from your Windows. The difference is you can click a checkbox to “Reconnect at logon” so you won’t need to map it every time you log on to Windows if you want it permanent. Alternatively, some companies have DOS batch scripts that run automatically when you log on so adding the drive map command to one of those scripts would achieve the same thing.
While it’s pretty straightforward on Windows, it’s not so much so on Linux. The first thing to do is set up the folder for sharing on Windows. On whatever folder you want to share, right click on it and select the “Sharing and Security” option. Enable the sharing of the folder and be sure to set the permissions correctly so that you will be able to access it from Linux with the right username and password. The mapping can be achieved through a series of commands (make sure you have root privileges on Linux for the “mount” command):
- Make a directory for the mount:
mkdir /mnt/<name-of-mount-point> - Mount the share:
mount -t smbfs -o username=<username>,password=<password>
//<win-box>/<share> /mnt/<name-of-mountpoint>- Note: The syntax
-username=<username>,password=<password>saves the password.
- Note: The syntax
- Create a symbolic link to the mounted drive: ln -s /mnt/<name-of-mount-point> /<path-of-symlink>
If you don’t have root privileges, you could try to create a bookmark in your desktop environment with a URL like so:
smb://windows-box/<share>
Then when you need access to the Windows share, simply open the bookmark, supply the credentials and your desktop environment should treat it like any Linux folder.













Leave a Reply
(* required)