Browsing into your NAS shared folders from a Windows PC on your LAN, is easy. It typically works out-of-the-box, every time.
All you do is to launch Windows explorer and click on the Network icon and it will automatically find any QNAP NAS server on your LAN (as well as any other network-sharing device you may have).
However, going the other way, isn't a piece of cake. It beats me why. I mean, since we all expect windows to be able to find the NAS, why shouldn't the NAS be able to find my Windows PC?
This [HOW-TO] guide describe how I managed to establish a permanent link to my Windows PC so by simply opening (running) File Station (the equivalent of Windows Explorer) I can now easily access the harddrive on my Windows PC from the NAS.
Why would I want to do that?
1. Because I can and will
2. Because I have data on my Windows PC that I maintain there with no desire to have copies of it on the NAS, but I'd like the NAS to be able to read this data.
3. Because when I log into my NAS using Cloudlink, I now have access to my Windows PC as well, without the need to open any ports in my router (firewall)!
4. Can you think of any additional good reasons?
Here's how I did it:
It's assumed that:
Network connections have been configured properly.
Your local (NAS) username is nasusername.
Share username on Windows computer is msusername.
Share password on Windows computer is mspassword.
The Windows computer's name is servername (this can be either an IP address or an assigned name).
The name of the share is sharename.
You want to mount the share in /media/windowsshare.
You can temporarely mount a Windows share from the command line of your NAS. Assuming you intend to access the remote share as part of an existing share:
Use Putty to SSH into your NAS and type the following on the command line:
Code: Select all
mount.cifs //servername/sharename /media/windowsshare -o iocharset=utf8,username=msusername,password=mspassword
To unmount, use:
Code: Select all
The name <windowsshare> can be anything of your choice, and the path </media/> can be anything of your choice. I typically used /share/Public/WindowsShare for my testing purpose.
This is just a name for a local share folder used to point to the remote windows machine. You must create this folder somewhere on your NAS. After unmounting the share, you should delete this folder if you have no further use for it.
The iocharset parameter is to make foreign characters like (æøå) work properly in foldernames.
However, the above isn't very useful unless your need is only on a one-off basis. But I included it for the sake of completeness, understanding and testing purpose. Cause if you can't make temporary connection, then you will not be able to make the rest of this guide work for you either.
HOW TO MOUNT A WINDOWS SHARE PERMANENTLY
This guide describes how to mount CIFS shares permanently. The shares might be hosted on a Windows computer/server, or on a Linux/UNIX server running Samba. This also applies to SMBFS shares, which are similar to CIFS but are deprecated and should be avoided if possible.
MOUNT A PASSWORD PROTECTED NETWORK SHARE
The quickest way to auto-mounting a password-protected share is normally to edit /etc/fstab (with root privileges), to add this line:
//servername/sharename /media/windowsshare cifs username=msusername,password=mspassword,iocharset=utf8,sec=ntlm 0 0
But it is generally not a good idea to write down usernames and passwords in clear text, therefore, using a specially prepared credential file, is a better approach.
Using a text editor (I use the 'vi' editor in this example because it is available in all QNAPs, but you can choose to use any editor of your choice), create a file for your remote servers logon credential:
Enter your Windows username and password in the file:
Save the file, exit the editor. Be aware that this file will be stored in your home directory (due to the ~/) and it will be a hidden file (because it begins with a .) The home folder for admin user on QNAP is /root unless changed. Perhaps a better idea is to use the /home folder or if your're logged on a user with admin privileges, you'll be using that users home folder. As long as you know where it is stored, it doesn't really matter.
Change the permissions of the file to prevent unwanted access to your credentials:
chmod 600 ~/.smbcredentials
Since the /etc/fstab is located in a RAM-disk on the QNAP (this is not according to Lunix standard), it will be overwritten with a clean file each time you reboot. Therefore, a different approach must be used on QNAP NAS's. (The following info has been partly copied from Don Muller's excellent QNAP Guide which can be found here: download/file.php?id=2096)
CUSTOMIZING QNAP STARTUP
There are certain files and settings that get reset back to factory defaults at every reboot. In
order to set those back to what you want you need to modify the autorun.sh script. This file is
executed every time the NAS is booted. It is located on a volume that is not normally
mounted. This means that anytime you wanted to edit the file you would have to mount that
volume, edit the file, and then unmount the volume. A better way is to make the autorun.sh file
a link to your own autorun file. This way you only have to edit your autorun.sh file which you can
store anywhere you like on an unmounted volume once. To change the autorun behaviour of your NAS,
you would just have to edit your own autorun file.
Here are the steps to change the default autorun.sh file into a link pointing to your own autorun.sh
On the ARM series NAS use the following:
Code: Select all
mount /dev/mtdblock5 -t ext2 /tmp/config #This makes that mtdblock5 folder from the NAS flash memory available (mounted) in /tmp/config
rm autorun.sh #Before deleting any existing autorun.sh, check to see if it contains anything valuable.
ln -sf /home/autorun.sh autorun.sh #This creates a symlink named autorun.sh pointing to your autorun.sh which is not located on the RAM disk.
On the Intel series NAS use the following:
Code: Select all
mount /dev/sdx6 /tmp/config
rm autorun.sh (see note 1)
ln –sf /path to your file/autorun.sh autorun.sh
If for some reason, like maybe during a firmware update, the link is replaced with the default
file, you would only have to restore the link as described above. Your autorun file would still be intact.
1. Check to see if the existing autorun.sh file has any entries in it before you delete it. If it
does copy them to you new autorun.sh file before deleting the one in /tmp/config.
2. Make sure you unmount the device before the NAS is rebooted.
3. Make sure the autorun.sh files are marked as executable (chmod +x autorun.sh).
4. Any files or executables that you reference in the autorun.sh file, or any files or
executables that are referenced by your scripts or other scripts, must use the full path
name. During the execution of autorun.sh the system will not perform a search to find
other executables or files; you must specify the full paths in everything that you
Then edit your own autorun.sh file by adding:
Code: Select all
mount.cifs //servername/sharename /media/windowsshare -o iocharset=utf8,credentials=/home/nasusername/.smbcredentials,sec=ntlm 0 0
That's it. Now reboot.
Go to File Station and browse into /media/windowsshare and viola, you're looking at your Windows machine
The above assumes of course that your Windows PC is turned, on, properly connected to your LAN (cabled or WiFi), and that it has Network and File Sharing enabled and that a folder has been shared.
I typically have the root folder of my C:/ drive shared, thus having access to everything on my Windows PC.
The above works for me. Let me know if it works for you as well.