0

I am not particularly familiar with Windows permissions, but I had assumed that elevated permissions were equivalent to sudo. However, I came across this "unexpected" behavior when running a simple python program via cmd.exe and powershell, which leads me to believe that it's not so clear-cut:

When the target directory has 755 permissions (the default), I cannot write to the directory if I'm running cmd.exe/powershell with elevated permissions. I can write to the directory if I'm not running elevated. If I change the directory permissions to 766, I can write to it with either elevated/regular permissions.

Using windows cli (cmd.exe or powershell):

echo "asdf" > testdir\testfile.txt

And a minimal example in python:

import os 

def main():
    fname = os.path.join(os.path.dirname(os.path.realpath(__file__)), "testdir", "testfile.txt")
    f = open(fname, "w")
    f.write("asdf")
    f.close()

if __name__ == "__main__":
    main()

So, what group does the elevated user belong to? And why does the elevated user not have permissions to directories that they created as a "non-elevated" user?

  • 1
    It depends, an elevation of permissions, typically means the Administrator group. However, it’s normal to have several different user groups, which all have higher permissions then a user in the User group. You will ha e to provide more information for any answer to be submitted – Ramhound May 27 at 22:05
  • @Ramhound - do you know of any way to find out what all the groups/group permissions are? All I know is that the elevated group is not equivalent to the admin group – asdf May 27 at 22:09
  • @asdf- If you running the process with “run as administrator” it certainly is a member of that group. How do you know the elevated group isn’t part of the Administrators user group? – Ramhound May 27 at 22:20
  • 2
    You will have to ask your Administrator what user group the elevated user is in exactly. “Run Elevated” isn’t a default right-click menu item and is custom to your work environment. It was added by your Administrator. You will have to answer this question yourself since the name of the user group isn’t know to us – Ramhound May 27 at 22:32
  • 1
    whoami, gpresult /v, and icacls "c:\folder". I have no idea what is 755 is. Obviously not a Windows thing. – Mark May 28 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.