# HG changeset patch # User Oleksandr Gavenko # Date 1494426293 -10800 # Node ID a8885a695eab60bae9ad46bf86fe8935027464b8 # Parent 511c1dd5b01083b8e9bdd93357760f8ff07b330c User management. Remove all permissons from file. diff -r 511c1dd5b010 -r a8885a695eab windows.rst --- a/windows.rst Tue May 09 18:53:26 2017 +0300 +++ b/windows.rst Wed May 10 17:24:53 2017 +0300 @@ -462,24 +462,17 @@ schtasks /delete /tn %TASK_NAME% /f -Change NTFS permission. +Change NTFS permissions ======================= - http://support.microsoft.com/kb/919240 - The Icacls.exe utility is available for Windows Server 2003 with - Service Pack 2 - -Change NTFS permission with 'icacls'. -------------------------------------- +``icacls`` allow option: -'icacls' allow option: - - * /c - Continues the operation despite any file errors. Error messages will - still be displayed. - * /t - Performs the operation on all specified files in the current directory - and its subdirectories. - * /l - Performs the operation on a symbolic link versus its destination. - * /q - Suppresses success messages. +* ``/c`` - Continues the operation despite any file errors. Error messages will + still be displayed. +* ``/t`` - Performs the operation on all specified files in the current + directory and its subdirectories. +* ``/l`` - Performs the operation on a symbolic link versus its destination. +* ``/q`` - Suppresses success messages. Recursively change the owner of all matching files to the specified user:: @@ -494,6 +487,44 @@ cmd> icacls %dir% /t /grant:r %user%:(f) cmd> icacls %dir% /t /grant:r *S-1-1-0:(f) +Remove all permissons from file (first reset to inherited, then remove inherited):: + + cmd> icacls %FILE% /reset + cmd> icacls %FILE% /inheritance:r + +http://support.microsoft.com/kb/919240 + The ``Icacls.exe`` utility is available for Windows Server 2003 with Service Pack 2. + +User management +=============== + +List available users:: + + cmd> net user + cmd> wmic useraccount list brief + +List available groups:: + + cmd> net localgroup + +List available users in group:: + + cmd> net localgroup %GROUP% + cmd> net localgroup Administrators + cmd> net localgroup Users + +Current logged user:: + + cmd> whoami + +Create new user by supplying password argument:: + + cmd> net user /ADD %USER% %PASS% + +Create new user by entering password in prompt:: + + cmd> net user /ADD %USER% * + Well-known security identifiers (SID). ======================================