User management. Remove all permissons from file.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 10 May 2017 17:24:53 +0300
changeset 2131 a8885a695eab
parent 2130 511c1dd5b010
child 2132 b7f0192f395f
User management. Remove all permissons from file.
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).
 ======================================