Shared Folders/samba with DOS guest on VBox 4.1.8

bpoint
Posts: 6
Joined: 27. Nov 2010, 17:35
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Windows 7 x64
Location: Japan

Shared Folders/samba with DOS guest on VBox 4.1.8

Post by bpoint »

After trying to follow the very old HOWTO and following some of the hints in this post, I finally managed to get Shared Folders in a DOS guest to work properly in the latest VirtualBox 4.1.8. Below, I'll describe each step necessary to get everything working.

The most important point to make clear -- which caused me the most confusion -- is that *true* Shared Folders are NOT SUPPORTED in DOS guests. You cannot use the VirtualBox Manager to point to a folder on the host, and make it visible in the guest. Instead, what can be done, is installing drivers in the DOS guest to access the virtual network adapter, which can then connect to a Samba share on your network (or the same PC as the host). This means you will need a Samba server setup which exports a shared folder in order to access it from the DOS guest.

NOTE: This HOWTO was written using Linux as the host, with samba-3.6.1 running on the same PC as the DOS guest. Windows hosts should be supported using the file sharing built-in to the OS, but I don't have any specific information on how to set that up. I also don't have any information for setting up a share on Mac OSX hosts either. If anyone can contribute this information, please post in this thread!

So, here's a list of what's required:
1) An already setup Samba server exporting the share you want to mount in the DOS guest.
2) An already installed DOS in a VirtualBox guest (MS-DOS, FreeDOS, doesn't matter). I used MS-DOS 6.22.
3) Microsoft Client for Networks for DOS from microsoft.com: DSK3-1.EXE (864,723 bytes) and DSK3-2.EXE (288,142 bytes)
4) Advanced Micro Devices PCNET NDIS2 driver from amd.com: wfw31.zip (166,262 bytes)

You do not need any other files, like the ones listed on the older HOWTO. Below are the MD5 hashes of the three files listed above. Feel free to check your downloaded files with these hashes, if you want:
2a0a0065e8080a3e46e55658415cfb76 *DSK3-1.EXE
532c91001ff4750407b00af7007e0984 *DSK3-2.EXE
24d38d936ef9040ec70ba0df9701016a *wfw31.zip

Right, let's get on with installing!

1) First, you'll need to unpack the AMD PCNET driver. Decompressing the .zip gives you an .exe -- which is a Windows executable, not a DOS one. Run the wfw31.exe within a Windows environment (I used wine-1.3.28), which will decompress the DOS drivers to the path: C:\pcnet\wfw31. The only two files you'll need from that directory are: oemsetup.inf and pcntnd.dos.

2) Next you need to actually get the necessary files into your DOS guest. The best way to do this is to create a floppy disk image. If you're on Windows, you can use WinImage to do this. If you're on Linux, using the loopback device to mount an image and copying the files inside is probably the easiest:

Code: Select all

# dd if=/dev/zero of=/tmp/floppy.img bs=1024 count=1440
1440+0 records in
1440+0 records out
1474560 bytes (1.5 MB) copied, 0.00308289 s, 478 MB/s
# losetup /dev/loop1 /tmp/floppy.img 
# mkdosfs -F 12 -v /dev/loop1
mkdosfs 3.0.12 (29 Oct 2011)
/dev/loop1 has 2 heads and 18 sectors per track,
logical sector size is 512,
using 0xf0 media descriptor, with 2880 sectors;
file system has 2 12-bit FATs and 1 sector per cluster.
FAT size is 9 sectors, and provides 2847 clusters.
There is 1 reserved sector.
Root directory contains 224 slots and uses 14 sectors.
Volume ID is 53ed3d35, no volume label.
# mount -o loop /dev/loop1 /mnt/floppy
# cd /mnt/floppy
# cp ~bpoint/dl/msdos6/net/DSK3-1.EXE .
# cp ~bpoint/dl/msdos6/net/DSK3-2.EXE .
# cp ~bpoint/dl/msdos6/net/oemsetup.inf .
# cp ~bpoint/dl/msdos6/net/pcntnd.dos .
# umount /mnt/floppy
# losetup -d /dev/loop1
3) Open up the VirtualBox Manager Settings panel for your DOS guest. Under "Network", ensure the adapter is enabled -- "Attached to:" can be set to NAT. (I'll assume you already have a Floppy Controller added to the Storage Tree, since it was likely necessary to install DOS in the first place.)

4) Boot your DOS guest. Mount the floppy image you just created, and copy all of the files somewhere to the virtual hard disk, like C:\TEMP (you should avoid C:\NET as this is the default path which will be used by Microsoft Network Client!).

5) Run the DSK3-1.EXE and DSK3-2.EXE files in the temporary directory to decompress them. Three files (two .txt files and one .com file) in DSK3-1 also exist in DSK3-2, so you can either overwrite or skip them.

6) Run the decompressed setup.exe. This will start the install for the Microsoft Network Client v3.0 for MS-DOS.

7) When presented with a network adapter selection, pick "*Network adapter not shown on the list below ...". Enter the path to the oemsetup.inf file you copied earlier (C:\TEMP should be the default), and press Enter. The only selection available will be the "Advanced Micro Devices PCNET Family", so select that one. Next, you'll be prompted to configure network buffers for "best performance". Since DOS already has very little memory for applications with the network drivers loaded, I have only used the Network Client without performance (it's not that slow anyway), so hit 'C'.

8) Next you'll be asked to enter a user name. Enter the same login name you use to authenticate to your Samba server.

9) On the next screen, you'll be presented with a review of the setup options. First, we don't need the Full Redirector, so select "Change Setup Options", and under "Change Redir Options", pick "Use the Basic Redirector." The other options are fine for this menu, so select "The listed options are correct." once.

10) Next, you'll need to add TCP/IP support, so select "Change Network Configuration". Select "Add Protocol", then "Microsoft TCP/IP". You're done here, so select "Network configuration is correct."

11) Everything is now configured, so start the Network Client install by selecting "The listed options are correct." from the setup options review screen.

12) After the setup files have been copied, unmount the floppy disk image (if it's still mounted), and press Enter to reboot your DOS guest.

13) After rebooting, you'll be prompted to "Type your user name, or press ENTER if it is <USER>:". If the user name is correct, just hit Enter, otherwise enter the correct user name. Next, you'll need to enter your password to access the Samba server. After entering your password, you'll get a prompt saying "There is no password-list file for <USER>. Do you want to create one?" Select Y if you don't want to enter your password after every reboot, or N if you're security conscious and want to authenticate every time.

14) Finally at the DOS prompt, you can map a shared folder to your DOS guest with the command: "net use e: \\<sambaserver>\<sharename>". If you authenticated properly, and the share is accessible, you'll see "The command completed successfully.", hopefully like the screenshot below:
Image

15) Once a "net use" command completes successfully, the drive will automatically be remapped after every reboot. To unmap a drive, use the command: "net use /d e:".

16) Feel free to remove the temporary C:\TEMP folder, as you no longer need it.

Congratulations, you now have Samba working in a DOS guest! Hopefully this helps others trying to get this working as well. If I missed anything, or if someone runs into a problem, let me know and I'll try to help out. Good luck!

Tip: Since this HOWTO describes how to connect using TCP/IP, the NWLink drivers are unnecessary. Edit your autoexec.bat and remove (or comment out by inserting "rem" in front of) the following two lines: "C:\NET\nwlink" and "C:\NET\nmtsr.exe". Not only will this will increase your available DOS memory by 16KB, but it will also provide a faster connection to the samba server on bootup.
Last edited by bpoint on 20. Jan 2012, 17:16, edited 8 times in total.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by michaln »

It might be more useful to update the virtualbox.org wiki howto...

Does NAT networking really work for you when the share is on the same host which runs the VM? I'm pretty sure that doesn't work on Windows, but maybe that has changed.

Also, your howto is nice, but not terribly useful for people using a Windows host and probably not much better for OS X hosts. You should make that clear up front.

And I'm amused that you (correctly) explain that this method does not provide shared folders in the VirtualBox sense, yet you use the term "shared folders" in the topic name anyway :)
bpoint
Posts: 6
Joined: 27. Nov 2010, 17:35
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Windows 7 x64
Location: Japan

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by bpoint »

michaln wrote:It might be more useful to update the virtualbox.org wiki howto...
Oh, I wasn't aware the wiki was public access. Actually... I can't seem to login to it. Is there some other registration I need to do to?
Does NAT networking really work for you when the share is on the same host which runs the VM? I'm pretty sure that doesn't work on Windows, but maybe that has changed.
Yep, I originally had Bridged Networking enabled from reading the other HOWTO, but did a complete reinstall while typing this up with NAT enabled. The samba server is running on the same PC as the guest.
Also, your howto is nice, but not terribly useful for people using a Windows host and probably not much better for OS X hosts. You should make that clear up front.
Reasonable enough. I'll add a comment at the top.
And I'm amused that you (correctly) explain that this method does not provide shared folders in the VirtualBox sense, yet you use the term "shared folders" in the topic name anyway :)
That was only to get Google and the site search to be able to find this page with the search terms that people are most likely to use. :)
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by Perryg »

I've made this sticky for now to keep from loosing it.

Any chance to get this configuration checked on a Windows host? I don't have one at the moment so I can't.
bpoint
Posts: 6
Joined: 27. Nov 2010, 17:35
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Windows 7 x64
Location: Japan

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by bpoint »

Perryg wrote:Any chance to get this configuration checked on a Windows host? I don't have one at the moment so I can't.
I'll have access to both a Windows PC and a Mac next week. Give me a few days and I'll see if I can figure out what's necessary to get them both working.
freezesicle
Posts: 12
Joined: 31. Dec 2011, 03:06
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: DOS 6.22
Location: Charlotte, NC

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by freezesicle »

Yes I have shared folders working with DOS 6.22 guest and Win7 64bit Home Premium host running VirtualBox 4.1.8 using the same basic steps the OP posted. Obviously I have no samba server running on the Windows host.

One important difference is that I installed the optional files from the older HOWTO. Especially WG1049.EXE. This allows the user to use the "net share" command to serve DOS shares to the host or other guests. The details are a couple of posts down from this one if you are interested. This will use more conventional memory to install the sharing service but it is very convenient in some cases. It is optional and you can use the "net use" command without installing WG1049.EXE if you just want to connect to a host share from the guest.

If you are using a Windows 7 host there may be an additional complication to getting the DOS guest to connect to the host share. See michaln's post below this one to see the fix. I can verify it works at least on Win7 64bit Home Premium. michaln has verified it on Win7 Ultimate.

Without the Win7 fix I can map the DOS share to a drive under Win7 but can't use a Win7 share under DOS. So in other words I can use the "net share" command but not the "net use" command. With the fix I can do both.

I am using bridged adapter btw.

In config.sys
---------------
DEVICEHIGH=C:\NET\ifshlp.sys

In autoexec.bat
------------------
LH C:\NET\net initialize
LH C:\NET\netbind.com
LH C:\NET\umb.com
LH C:\NET\tcptsr.exe
LH C:\NET\tinyrfc.exe
LH C:\NET\emsbfr.exe
LH C:\NET\net logon <username> ? /YES /SAVEPW:NO < C:\NET\password.txt
LH C:\DOS\share
LH C:\NET\net start server

Using "NET SHARE CDRIVE=C:\" to get the share active.

(oh yea after installing the nic driver and tcp protocol using the Microsoft Client for Networks for DOS setup I had to then go manually edit C:\NET\SYSTEM.INI and set "filesharing=no" to "filesharing=yes")

I have both the Win7 host and DOS guest using the same workgroup name. I have homegroups turned off.

Initially Win7 didn't list the DOS share under Start Menu-->Computer-->Network so I had to right click on Start Menu-->Computer and choose "Map network drive".

Here is the weird thing. My DOS guest computer name is VBDOS622 in C:\NET\SYSTEM.INI but I couldn't get Win7 to map that using \\VBDOS622\CDRIVE. I had to map it with \\Vbdos622\CDRIVE. It was case-sensitive and needed the first letter capitalized....weird. Took a while to try that haha. Actually VB helped. I had a Win XP guest running at the same time in bridged mode also and it saw the DOS guest as "Vbdos622" so I figured I would try that with the Win7 host and it worked. Go figure. Until then I was scratching my head a lot as to why I couldn't map the drive.

Yes, it uses a ton of conventional memory (>100K) (it can't all be loaded high even though I try) but I still have 450K left after starting the network services. Enough to get most everything I want done.

Also I have a WinXP guest I use occasionally and it had none of these problems communicating with the DOS guest. I could see DOS shares and share XP folders with DOS with no fuss. I can imagine a XP host would be as accommodating. I think Win7 likes to make things difficult haha.
Last edited by freezesicle on 25. Jan 2012, 06:08, edited 8 times in total.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by michaln »

It is possible to access a Windows 7 share from DOS, but Microsoft has made that somewhat difficult. The symptom is the message "Error 5: Access is denied" when the correct credentials are used with "NET USE" attempting to map the Win7 share from DOS.

On a Windows 7 Ultimate host, I had to do the following:

1) Start gpedit and change the "Network Security: LAN Manager authentication level" setting under Computer Configuration/Windows Settings/Security Setings/Local Policies/Security Options to "Send LM & NTLM - use NTLMv2 session security if negotiated". (perhaps unnecessary?)

2) In the same tab, change "Network security: Do not store LAN Manager hash value on next password change" to "Disabled". (required)

3) Ran "gpudpate /force" to propagate the settings. (perhaps unnecessary?)

4) Updated the password for the account. (required)

Step 4) is crucial because only when the password is changed (even to the same password), the LM password hash will be calculated and stored. Without the LM hash, DOS (and maybe Win9x) can't authenticate when connecting to a share provided by Windows 7.


On an unrelated note, there's a trick to use when the VM is configured for NAT. In that case, the VM often won't "see" the host (at least not Windows). The ADDNAME command can be used to manually assign an IP address to the desired name (e.g. "addname myhost 192.168.1.123"); the name then can be utilized with NET USE etc. With bridged networking, this isn't an issue.


On a yet different unrelated note, it is possible to set up DOS networking with the E1000 emulated adapter. The E1000 setup is faster than PCnet, but uses more memory. In most cases probably not worth it.
freezesicle
Posts: 12
Joined: 31. Dec 2011, 03:06
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: DOS 6.22
Location: Charlotte, NC

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by freezesicle »

michaln wrote:It is possible to access a Windows 7 share from DOS, but Microsoft has made that somewhat difficult. The symptom is the message "Error 5: Access is denied" when the correct credentials are used with "NET USE" attempting to map the Win7 share from DOS.

On a Windows 7 Ultimate host, I had to do the following:

1) Start gpedit and change the "Network Security: LAN Manager authentication level" setting under Computer Configuration/Windows Settings/Security Setings/Local Policies/Security Options to "Send LM & NTLM - use NTLMv2 session security if negotiated". (perhaps unnecessary?)

2) In the same tab, change "Network security: Do not store LAN Manager hash value on next password change" to "Disabled". (required)

3) Ran "gpudpate /force" to propagate the settings. (perhaps unnecessary?)

4) Updated the password for the account. (required)

Step 4) is crucial because only when the password is changed (even to the same password), the LM password hash will be calculated and stored. Without the LM hash, DOS (and maybe Win9x) can't authenticate when connecting to a share provided by Windows 7.


On an unrelated note, there's a trick to use when the VM is configured for NAT. In that case, the VM often won't "see" the host (at least not Windows). The ADDNAME command can be used to manually assign an IP address to the desired name (e.g. "addname myhost 192.168.1.123"); the name then can be utilized with NET USE etc. With bridged networking, this isn't an issue.


On a yet different unrelated note, it is possible to set up DOS networking with the E1000 emulated adapter. The E1000 setup is faster than PCnet, but uses more memory. In most cases probably not worth it.
Just to note that Home Premium versions of Windows 7 do not come with gpedit.msc so the above changes cannot be performed by default.

But if you read the comments on this link you can see how to get the gpedit.msc working on Windows 7 Home Premium:
http://windows7forums.com/windows-7-sup ... t-msc.html

I just installed it and performed michaln's steps above (except step 3 - gpudate is not on Home Premium either) and am happy to say that my DOS guest can now successfully execute the NET USE command to access the Win7 share (before I was getting the "Error 5: Access is denied" message).

Thanks michaln!
Last edited by freezesicle on 21. Jan 2012, 06:39, edited 1 time in total.
freezesicle
Posts: 12
Joined: 31. Dec 2011, 03:06
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: DOS 6.22
Location: Charlotte, NC

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by freezesicle »

Another note: Even though the OP stated that the other files in the older HOWTO are not needed they can be useful in certain cases if using a Windows host.

Here are the files and a brief description of what they offer...I have all of them installed on my DOS guest.

Specifically WG1049.EXE file is required if you want to serve a DOS share to other Windows hosts/guests i.e. use the "net share" command as opposed to "net use". To me it is much easier to work from the Windows host accessing the DOS guest than vice-versa. ymmv.

Microsoft update to add server functionality to MS Client (Optional)
ftp://ftp.microsoft.com/Softlib/MSLFILES/WG1049.EXE

Microsoft update replaces WG1049.EXE and fixes problem with the Basic Redirector (Optional)
ftp://ftp.microsoft.com/softlib/mslfiles/NNET.EXE

Text interface to configure shares (Requires WG1049.EXE or NNET.EXE installed to work) (Optional)
ftp://ftp.microsoft.com/Softlib/MSLFILES/NETSHAR.EXE

If you want a good overview of the types of network adapter options available in VirtualBox (NAT, Bridged Adapter, Host-only or Internal Network) this link is a good resource:
http://www.dedoimedo.com/computers/virt ... aring.html
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by michaln »

All the gpedit settings correspond to registry keys, too. So someone could potentially setup a .reg file to "compatibilize" (I hope that's not a word) newer Windows versions with older MS networking software.

My further testing shows that changing the LM authentication level isn't required for DOS VMs accessing the host's shares, at least not on Win7 Ultimate. The default setting is already acceptable because it doesn't prevent LM/NTLM logons from clients (some of the settings would, though).

The "gpupdate /force" command shouldn't be necessary on regular workgroup machines either, only on domain controllers.

There are other relevant settings which I didn't have to change because the defaults on Win7 Ultimate were okay, but might be different on other Windows versions.

Microsoft's KB article http://support.microsoft.com/kb/823659 contains further details, although it is quite hard to work with.
LaxSlash
Posts: 12
Joined: 17. Mar 2012, 02:09

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by LaxSlash »

This looks like a good tutorial, but everytime that I try extracting the wfw file, it keeps saying that the archive is corrupt. I've downloaded it multiple times, but the same thing keeps happening. Can you post the working one as an attachment?

EDIT:

The checksum I got was:
BC4F6B74A21F06AEC09B80AD36114A32 *wfw31.zip

EDIT 2:

Got the right file by Right Clicking, choosing Copy Shortcut, then pasting it in the web browser address bar.
LaxSlash
Posts: 12
Joined: 17. Mar 2012, 02:09

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by LaxSlash »

Got another issue, that I can't find help anywhere for.

When I try to Browse for Printers, I get the error "ERROR 58. The network has responded incorrectly. EXPLANATION: You are attempting an operation that can not be performed by the specified server."

It shows my computer and the network printer in the box. But, when I try to do anything, it locks up NET, and I have to use Ctrl+Del to reboot it.
ghr
Volunteer
Posts: 376
Joined: 25. May 2007, 22:46
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: DOS, Win3x, Win95, WinXP, Ubuntu, OS/2

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by ghr »

4.1.10: Got his to work (thank you michaln for your Win instructions) on Win 7 Prof SP1 64 bit, using VirtualBox 1.4.10. Seems that I have the same functionality that I was used to: acces a host folder from a DOS 6.22 VM. So far so good....
4.1.12: had to move from Host-only to NAT; and use ADDNAME command in guest. Doesnt make sense yet but this approach seems more consistent.
ghr
Volunteer
Posts: 376
Joined: 25. May 2007, 22:46
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: DOS, Win3x, Win95, WinXP, Ubuntu, OS/2

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by ghr »

Small addition based on recent VirtualBox 4.2.16 and Ubuntu 10.04, 12.04: for me the summary of this all is that you can have networking from MSDOS to Win and Linux when using the TCPIP stack. Seems to me that that should alo hold for FreeDos. In addition FreeDos has the option to set up FTP - you gain memory but loose flexibility. My smb.conf has a few changes taking it away from a bare bones install: I changed the workgroup name and added these three lines extra (not sure if they are really needed anymore)

Code: Select all

	lanman auth = Yes
	client lanman auth = Yes
	client plaintext auth = Yes
According to my notes these three were once added for Win98.
mtr
Posts: 2
Joined: 2. Nov 2013, 04:49

Re: HOWTO: Shared Folders/samba with DOS guest on VBox 4.1.8

Post by mtr »

bpoint wrote: 4) Advanced Micro Devices PCNET NDIS2 driver from amd: ..(deleted because the forum won't allow me to post).. wfw31.zip (166,262 bytes)
This is no longer an option from AMD.

Are there are other sources?
Post Reply