Access to Windows shares from Linux

I've spent a few hours recently investigating Mono for work. The intent is so that we (all right, I) can talk intelligently about what it would take to get DevExpress' controls working with Mono, rather than just say, no dunna work, or something equally as illiterate and uninformative. To make this easy for the likes of me, the Mono team have set up a virtual machine (VM) running SUSE Linux and containing a complete Mono install. Piece of cake you might say, and so it is. It was the matter of a few minutes to download the VM and to run it in VMware Workstation.

No problem, at least until the point when I tried to access some shared Windows folders from Linux. No matter what I tried nothing would work. And this is from a guest Linux OS to the host Windows 7 OS, which you'd imagine would be something really simple. It took me a good 3 hours or so over a couple of days to get it to work. Here's what I did.

Part of the problem, it seems, is LAN Manager from Windows 7. Every time I'd try and mount the share from Linux, this server would give up and post an error to the event log:

The server was unable to allocate from the system nonpaged pool because the server reached the configured limit for nonpaged pool allocations.

Yeah, that makes a lot of sense on a machine with 8GB of RAM. Plus, there's no hint on how to, you know, increase this configured limit. Back to this later.

Event in event viewer

On the Linux side, I started off using the GNOME UI from the desktop to connect to the Windows shares. I'd see the icon for Windows Network, double-click and see the workgroup I use at home. Double click on this, and I'll see the computers. Double click on that and nothing, zip, nada, zilch. No list of shares.

OK, it was time for some command line stuff. First I started up a terminal, and then switched to superuser:

su

I then had to type the password, of course. I did some searching  and found the command online to list the shares using the smbclient tool.

smbclient -L //nameofwindowspc

Nothing. More searching and I found a hint that I had to create a user on my Windows machine that matched my Linux login. Did that, and finally was able to get a list of shares from the tool (still nothing from the UI, by the way).

Onto the next command, to mount a share (I'd flipped over to Windows, and made sure I added my linux user to the share).

mount -t cifs -o username=xxx,password=yyy //nameofwindowspc/nameofshare ./windows

The xxx/yyy stuff is obviously my login details for Linux. The final parameter there is a mount point: you must create this directory first (and the way I ran things is that the superuser was logged into my user's home directory, so this mount point was in that same home directory). Failure: the mount failed with an out-of-memory error (error 12).

Ah ha! The same error — in a very hand-wavy way — as on the Windows side. Time for more searching.

image I found another hint: Windows 7 (and Vista for that matter) comes with an SMB2 server. Apparently this is the problem, and you must stop it from running. Time for regedit: create a new DWORD value called SMB2 in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters, and set it to 0 (the default). This will turn off the SMB2 server and run the SMB1 server instead. Reboot.

After I did this, the mount command worked successfully. I was able to access the files and folders in the share by navigating to the mount point, even on the GNOME desktop (although the desktop seems to think the share is a "Picture CD" for some reason).

And, then, it was back to investigating Mono: the share had a bunch of ASP.NET applications in it and I was able to start "playing" around.

Now playing:
Duran Duran - UMF
(from Duran Duran [The Wedding Album])

Loading similar posts...   Loading links to posts on similar topics...

No Responses

Feel free to add a comment...

Leave a response

Note: some MarkDown is allowed, but HTML is not. Expand to show what's available.

  •  Emphasize with italics: surround word with underscores _emphasis_
  •  Emphasize strongly: surround word with double-asterisks **strong**
  •  Link: surround text with square brackets, url with parentheses [text](url)
  •  Inline code: surround text with backticks `IEnumerable`
  •  Unordered list: start each line with an asterisk, space * an item
  •  Ordered list: start each line with a digit, period, space 1. an item
  •  Insert code block: start each line with four spaces
  •  Insert blockquote: start each line with right-angle-bracket, space > Now is the time...
Preview of response