Modifying msys privileges on windows 7

1

How do I run a cmd.exe command in msys as a superuser? I am the only user on my laptop and have full administrative privileges once I login. I assumed I did when I fired up an msys shell, but running:

cmd //c 'mklink link.txt file.txt'

returns that I do not have sufficient privilege to perform this operation.

greg burgreen

Posted 2014-06-03T17:15:43.140

Reputation: 11

open a command promopt and esclate the process by using "run as administrator" this only works if the user your using is an Administrator otherwise you have to supply the Administrator's username and password. – Ramhound – 2014-06-03T17:24:24.380

Beautiful. What I did was modify the properties of my msys shortcut to "run as administrator" and that worked perfectly. Thanks for the hint, Ramhound! – greg burgreen – 2014-06-03T17:35:26.307

Administrator rights are not required to create hard links. If that's what you were trying to do, the actual syntax would be cmd /c mklink /h "hard link" "the target file" – and31415 – 2014-06-03T17:42:41.100

Yes, and31415 is correct. I was after symbolic links. Though, my shell required the command to be: cmd //c mklink //h hard_link target_file to escape the forward slash side effects on the msys bash shell. – greg burgreen – 2014-06-03T17:45:49.720

The reason you were getting the not-enough-privileges error is that if you omit the /h switch you're creating a symbolic link, something which was first introduced in Windows Vista along with the mklink command. Per default system settings, you need administrator rights in order to create symbolic links. – and31415 – 2014-06-03T17:50:41.507

Answers

1

Creating hard links

When using the mlink built-in command to create hard links you need to use the /h switch. If you omit it, the command will create a symbolic link instead.

Symbolic links were first introduced in Windows Vista along with the mklink command. Unlike hard links, you do need administrator rights in order to create symbolic links, per default system settings. And that's the very reason you were getting the not-enough-privileges error.

Simply put, this is the command syntax you need to use:

cmd //c mklink //h hard_link target_file

Further reading

and31415

Posted 2014-06-03T17:15:43.140

Reputation: 13 382