Mounting Windows SMB share from Debian Wheezy

Configuring an SMB mount from my Linux box to my Windows box. This was helpful.

Basically:

# apt-get install cifs-utils

Then create your credentials file:

# cat > /root/amanda.smbpass  <<EOF
username=jj5
password=SECRET
EOF

Then edit /etc/fstab and add:

//amanda.jj5.net/Users  /media/amanda cifs defaults,noauto,credentials=/root/amanda.smbpass 0 2

Then create /etc/network/if-up.d/mount-amanda like this:

#!/bin/bash
mount /media/amanda

And make sure it’s executable:

# chmod +x /etc/network/if-up.d/mount-amanda

Mounting can also be done from the command-line:

# mount -t cifs -o username=jj5,password=SECRET //amanda.jj5.net/Users /media/amanda

100% Apache-Compliant REQUEST_URI for IIS and Windows

I had a problem with the REQUEST_URI server variable not being available in my PHP app when running under IIS on Windows. I followed these instructions to fix the problem: 100% Apache-Compliant REQUEST_URI for IIS and Windows.

I had to download and install ISAPI Rewrite 3 and Request_URI for IIS 1.1 which I installed into PHP by editing my php.ini file with this line:

 auto_prepend_file = C:\Program Files\PHP\request_uri.inc

Enabling Windows SDK 7.1 in Visual Studio 2008

I was having a problem where Visual Studio was saying that “windows.h” could not be found after having installed the Windows SDK v7.1. I found this article which said to update the path in “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\CurrentInstallFolder” in the registry. So I did that, and now everything is working.

File names on Windows

I’ve been reading up on file names in Windows because I’m having a problem with my C++ code processing a file with an odd TM character in the file name. I’m not sure why, but it seems that file names returned by the POSIX readdir function don’t necessarily exist when then given to ifstream.open, or some weird character encoding thing is going on. Hopefully I get to the bottom of it. It’s a complete fluke that I actually had a file this failed on available and did testing on it, lucky I guess.

I did some more reading and discovered that there are ‘wide character’ versions of the file functions for Windows that use UTF-16 encoded strings rather than ‘code page’ encoded strings, I guess. Anyway, I don’t think I’m going to bother with such things, if the file can’t be opened because it has a weird character in it then I’ll just fail with an error message and the user can look at fixing it. This program is only being “developed and tested” in Windows, there are no plans to actually run it on Windows, it will run on Linux, which won’t have this weird character encoding issue.