msys2 / MSYS2-packages

Package scripts for MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
1.28k stars 486 forks source link

Coreutils: ln --symbolic creates hard links -- part 2 -- #1377

Open aabatpurdue opened 6 years ago

aabatpurdue commented 6 years ago

This really should have been part of issue #249 but I do not know how to reopen a closed issue.

And here is how to use symlinks. See Symlinks in Windows, MinGW, Git, and Cygwin · Josh Kelley. To summarize, "administrators" are, by default, allowed to make symlinks according to the Group Policy entry. If you are not an administrator, you need Windows 10 Creator release or newer and and a friendly administrator to (1) if necessary, install 'gpedit.msc' in the HOME edition and (2) use 'gpedit.msc' to add your id to the list of users allowed to make symlinks. Then you can use MSYS=winsymlinks:nativestrict. It is all explained in much more detail in the above link and it's sublinks. FWIW - if 'gpedit.msc' is not available on your HOME edition, the files you need to install 'gpedit.msc' are already on the machine, just not installed. One of the sublinks supplies a batch script to do the install and another describes the way to get to the Group Policy permission entry.

Oops, forgot that you need to enable "developer mode" also. Also described in the above link

niklasholm commented 6 years ago

MSYS=winsymlinks:nativestrict is already covered in the original thread. Please close this and keep the discussion in one thread. You can still make comments even if the thread is closed.

vyache76 commented 6 years ago

Also remember, if you are a member of the Administrators group, even if you add yourself to the list of users who are allowed to create symbolic links, and you will run the shell in an unprivileged mode - you can not create symbolic links. UAC will cut off this rights (

Starting with Windows 10 Insiders build 14972 the requirement for elevated administrator privileges was removed, allowing symlinks to be created without needing to elevate the console as administrator

aabatpurdue commented 6 years ago

@niklasholm I would be glad to close this thread if you could tell me how to transfer the contents of this thread to the original. I was considering adding a comment there pointing at this thread.

@vyache-slav Actually, I seem to have a condition opposite others because I have been creating symlinks via the Command Console's mklink command for quite awhile mostly as unelevated pud user me. Just recently, I enabled winsymlinks:nativestrict on MSYS and CYGWIN with no problems there. I do not remember ever seeing the UAC (if I thought hard enough about it, that would probably be a lie (:-}) ). FWIW - the "administrators" that I referenced is the "administrators" group (id=544) and all accounts that have administrative rights are members of this group.

There is an additional permission set not mentioned other places that is controlled by the file administration software. On a Command Prompt window, execute the first line below fsutil behavior query symlinkEvaluation #fsutil behavior set /? #fsutil behavior set symlinkEvaluation L2L:1

I can run the first line unelevated as pud me. Don't know if that requires "administrators" permission or not. The 1st line printed should say something like "local to local symlinks are allowed". If that is not the case, an administrator would have to execute the 3rd line.

Another FWIW - as a test via gpedit.msc, I removed permissions for all accounts/groups disabling them to create symlinks, restarted (do not know if that was necessary) and I COULD STILL CREATE SYMLINKS AS PUD USER ME. There seems to another permission set somewhere (:@{).

Has everybody enabled "Developer mode"? This is a must do!

c

aabatpurdue commented 6 years ago

Update - I just disabled "Developer mode", attempted to make a symlink as unelevated pud me and got the following message. "You do not have sufficient privilege to perform this operation." Got the same message when elevated. No UAC was in evidence.

Created a vanilla user. No problems. So why is everybody else having problems? I did find on vanilla that administrative privilege is required to set "developer mode". It was already set.