Got not sufficient privileges message in CMD when logged on as administrator

37

7

I was trying to use mklink command in cmd (i have Windows 7 os) I was logged on as administrator, but i got a " you do not have sufficient privilege to perform this operation" message. I used the same command in Vista, it worked ok. Any ideas why it does not work in Winows 7?

ToZo99

Posted 2010-04-09T19:19:22.920

Reputation: 371

Answers

30

Try explicitly running the cmd shell as administrator. If that doesn't help, then try the runas command.

runas /user:administrator "mklink args"

Quotes around the mklink command and its args are required.

Michael Pryor

Posted 2010-04-09T19:19:22.920

Reputation: 2 536

what to do if you don't have a login password? it is asking for one and if I leave blank it tells me blank password error... – ecoe – 2014-08-17T18:21:50.243

so, after finding out winblows broke the years and years old 'cd' syntax for cd /D, you get to type in the mklink syntax in the horrible contraption called 'cmd.exe' to find out you don't have privileges nad had to run as administrator first. Winblows sysadmin, the horror aaargh. – Michael Trouw – 2016-01-18T18:23:11.607

Didn't work. Instead I had to: runas /user:administrator cmd, and then in that new window, run the mklink command. Argh! – Ross Smith II – 2016-04-29T13:55:24.417

19Symlinks are too dangerous for a normal user. LOL. I wish I could understand the considerations behind this. :-( – Notinlist – 2011-04-14T13:34:35.117

1My user is an administrator (there is no user called "administrator" on this machine.) but I still get "You do not have sufficient privilege to perform this operation." – Jonathan Hartley – 2012-01-08T18:35:38.027

4This answer, although helpful advice in the general case, seems to be exactly the opposite of the behaviour I'm observing: mklink only works for me when my user is not an administrator. Puzzling. – Jonathan Hartley – 2012-01-09T00:41:35.230

16

type CMD, you will see CMD.exe in the list at start menu.

Right click on it, select "Run as Administrator"

Eric Yin

Posted 2010-04-09T19:19:22.920

Reputation: 331

14

In response to this not working for administrator accounts, I believe that Configuring symlink support in Win7 is relevant.

After giving “Everyone” the privilege “Create symbolic link”, please reboot (or log off) and log in as a standard user, a user who is NOT a member of group “Administrators”. You should be able to create a symbolic link using mklink command in a directory where user has write permissions.

The reason a member of “Administrators” cannot create symbolic link is because “Create symbolic link” privilege is removed from the filtered token since user is a member of “Administrators” group. Section “Access Token Changes” of article at link http://msdn.microsoft.com/en-us/library/bb530410.aspx describes in more details on how filtered token is created.

Mike

Posted 2010-04-09T19:19:22.920

Reputation: 141

8Why does Microsoft always screw up? – CodeManX – 2016-04-15T09:35:29.207

@CoDEmanX, its complicated :) – alpha_989 – 2018-05-19T20:49:39.060

Wait, so... where does one set those write permissions? The linked articles are not exactly the clearest to read through. – Mike 'Pomax' Kamermans – 2019-10-22T14:29:43.587

9

First, make sure you've granted the "Create symlinks" permission to the relevant users, as detailed here: https://superuser.com/a/125981/57697

Bizarrely, the "mklink" command will not work for me if my user is an administrator. It gives "You do not have sufficient privilege to perform this operation."

To make it work, I then need to either remove my user from the administrators group, or run mklink from a cmd which has been run as a non-admin user such as guest:

   runas /user:guest cmd

(enable the guest account if it isn't already)

Using this latter method, you'll also have to temporarily grant permissions for 'guest' to modify the location you're creating the symlink in, which in my case was my home directory, causing a flurry of error dialogs, but they seemed harmless.

Jonathan Hartley

Posted 2010-04-09T19:19:22.920

Reputation: 736

It doesn't seem to work (I blame Microsoft). The runas command asks for the password of the specified user, even if the account doesn't have one. If you leave it blank (hit enter), it errors out. If the account does have a password and you type it in, then I end up with the system cannot find the file specified. Starting a cmd as admin, navigating to the target dir and creating the symlink with your own account suddenly appears so easy... – CodeManX – 2016-04-15T10:02:36.490

4

If, for some reason, you cannot elevate your account to an administrator (eg. you're on a work computer), and you're trying to link a directory, try creating a junction instead of a hard/soft link. The source folder can be absolute or relative.

mklink /J linkedfolder sourcefolder

hughes

Posted 2010-04-09T19:19:22.920

Reputation: 1 624

1Thank you. This worked for me as I do not have admin on my work pc and needed to link cygwin directories and windows directories. – dukevin – 2019-08-06T20:41:30.940

0

Check to see the "secondary logon" service isn't disabled.

surfasb

Posted 2010-04-09T19:19:22.920

Reputation: 21 453

8

As a highly valued Super User, I suggest you revisit this answer and add more detail.

– James Mertz – 2012-07-27T21:54:23.453

-3

If not installed, please installing Microsoft.net framework 2.0 or the service packs that go with it. It worked for me!

Jukmister

Posted 2010-04-09T19:19:22.920

Reputation: 1