Windows – Symbolic or hard link to UNC path: logon failure

file-sharingnetwork-sharewindows

I have a Synology NAS that exports a backup directory that I wish to access locally in a folder. I had this working before with a previous Synology NAS but I don't remember how I did it.

So I open an eleveted cmd prompt, cd to the directory and then execute:

C:\somepath> mklink /D Backups \\servername\Backups
C:\somepath> cd Backups
Logon failure: unknown user name or bad password

Creates the link fine, but there's permissions issue on access. But, I can open explorer and navigate to that folder just fine via the link.

A hard link yields the permission issue immediately:

C:\somepath> mklink /H Backups \\servername\Backups
Logon failure: unknown user name or bad password

Any thoughts on what I'm missing?

Best Answer

I finally managed this. The programs I'm running off of this share require privilege elevation, at which point they lost access to the share for some reason.

So the key is to map the drive persistently while in elevated mode:

C:\somepath> net use y: "\\servername\Backups" * /user:UserName /persistent:yes
The command completed successfully

C:\somepath> mklink /d Backups "\\servername\Backups"
symbolic link created for Backups <<===>> \\servername\Backups

C:\somepath> cd Backups
C:\somepath\Backups>

Previously this resulted in the "Login failure" error.

Edit: and if you have to do this globally for all users, see this post: https://stackoverflow.com/a/4763324/144873