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
mkdir /media/windowsshare mount.cifs //servername/sharename /media/windowsshare -o iocharset=utf8,username=msusername,password=mspassword
Code: Select all
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 cd /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. cd / umount /dev/mtdblock5
Code: Select all
mount /dev/sdx6 /tmp/config cd /tmp/config rm autorun.sh (see note 1) ln –sf /path to your file/autorun.sh autorun.sh cd / umount /dev/sdx6
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
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.
How to use REMOTE MOUNT from File Station instead
You can use the Remote Mount feature built into File Station as an alternative, but for some reason (don't ask me why), QNAP still - in 2020 - only support SMB 1.0
This protocol is inherently insecure and old fashion, and has been disabled by default in Windows for at least five years, but you can re-enable it.
And you must re-enable SMB 1.0 on every windows machine that you wish to mount as remote shares in a QNAP NAS.
The process is fairly straight forward:
1. Select a folder on your Windows machine using File Explorer, and share it using File Share and give your share a logical name of your choice
You can of course share the whole C:\ drive and thereby allow access to everything. (For some reason you cannot use the administrative share c$)
Choose Read Only or Read/Write access depending on your need.
2. Enable SMB 1.0 server protocol under Control Panel --> Programs and Features --> Turn Windows Feature On or Off
Scroll down the list and expand SMB 1.0/CIFS File Sharing Protocol Then tick only the server component, and click OK.
3. Back at you NAS, in File Station, click on Remote Mount in the upper right corner of the window and select Create Remote Mount in the menu.
Check the CIFS/SMB blue icon and click Next
In the configuration box, enter the IP address of your windows machine. It is highly preferable to have static IP addresses. If not, you should be able to use the NetBIOS name instead.
Type in a valid Username/Password combination that actually do have access to the share on your Windows machine.
In the Mount Specific Folder field, type the name you gave the share in 1 and press the Tab-key on your keyboard.
Note the peculiar name automatically assigned to your Mount in the field Connection Name. You can change this to anything you'd like it to be.
4. That' it. Click Create and after a while everything should be done and you'll find your new share in the folder list in File Station at the end of the list under CIFS/SMB