IT tutorials
 
Technology
 

Windows Server 2008 : Manipulating Users and Groups with the net Command, Modifying NTFS Permissions with icacls

8/21/2013 4:40:55 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

1. Manipulating Users and Groups with the net Command

You can also use the net command to create, modify, and delete users and groups. The following table shows some of the common commands.

net CommandDescription
Create user.
net user username password /add
c:\>net user Darril P@ssw0rd /add

Creates a new user with the specified name and password. The password must meet the password requirements of the system. If the command is executed on a local computer, it creates a local user account. If the command is executed on a domain controller, it creates an account in the Users container of Active Directory unless the redirusr command has changed the default location.
Create local group.
net localgroup groupname /add
c:\>net localgroup ITPros /add

Creates a local group with the group name. The group is created using the case specified in the command but can be identified later using any case.
Create group on domain controller.
net group groupname /add
c:\>net group ITPros /add

Creates a global security group using the group name. The group is added to the Users container.

Note

group works only on a domain controller and localgroup works only on a nondomain controller.

Add user (or group) to group.
c:\>net localgroup "event log
readers" Darril /add
c:\>net localgroup "event log
readers" ITPros /add

You can use the net localgroup command to add a user or group to an existing group. The examples add a user account (Darril) and a group (ITPros) to the preexisting event log readers group.
Delete user.
net user username /delete
c:\>net user Darril  /delete

Deletes the specified user account.
Delete local group.
net localgroup groupname /delete
c:\>net localgroup itpros  /delete

Deletes the specified local group.
Delete group on domain controller.
net group groupname /delete
c:\>net group itpros  /delete

Deletes the specified domain group.

2. Modifying NTFS Permissions with icacls

You can modify file and folder permissions with the icacls command. The basic format is

icacls file or folder /grant sid permission

Tip

icacls modifies NTFS permissions for files and folders. The net share command modifies the permissions for shares.


The security identifier (sid) can be expressed as the actual sid of a user or group (with an asterisk as a prefix) or with the friendly name. For example, the following two commands both work:

c:\>icacls c:\data /grant darrilgibson:f
c:\>icacls c:\data /grant *S-1-5-21-2165312475-2208171157-4291121935-1000:f

The following table shows the basic codes used for permissions.

Permission CodeDescription
FFull access
MModify access
RxRead and execute access
RRead-only access
WWrite-only access

The following table shows some common usage of the icacls command. You can substitute the f permission code (for full access) with any of the permission codes listed in the previous table.

icacl CommandComments
Show permissions for a folder.
c:\>icacls c:\data

You can show the current permissions using only the command and the name of the folder.
Grant permission to a user.
c:\>icacls c:\data /grant:r
darrilgibson:f
c:\>icacls c:\data /grant
darrilgibson:f

You can append the permissions to any other explicitly added permissions or replace all explicitly added permissions. When you use :r in the /grant (/grant:r) switch, it replaces explicitly assigned permissions.

Tip

Inherited permissions are still inherited when /grant:r is used.

Include subfolders.
c:\>icacls c:\data /grant:r
darrilgibson:f  /t

The /t switch includes all files and subfolders within the specified folder.
Deny permission to a user.
c:\>icacls c:\data /deny
darrilgibson:f /t

Instead of granting permissions, you can deny the permissions.

Tip

The deny permission always takes precedence. In other words, if a user is granted permission explicitly or as a member of a group and is also denied permission, the user is denied permission.

Remove permissions for a user.
c:\>icacls c:\data /remove
darrilgibson:f /t

Removes all ACL entries for the specified user.

 
Others
 
- Windows Server 2008 : Manipulating Shares with net share, Mapping Drives with net use
- Windows Server 2008 : Manipulating Shadow Copies with vssadmin
- Windows 7 : Disk Management (part 3) - Creating a Striped Volume, Creating and Attaching VHDs
- Windows 7 : Disk Management (part 2) - Dynamic Disk Management, Extending a Disk, Creating a Spanned Volume
- Windows 7 : Disk Management (part 1) - Assigning Drive Letters and Joining Volumes
- Windows 7 : Managing Hard Disks - The Nature of Hard Disks,Windows 7 File and Storage Systems
- SharePoint 2010 : Scaling out Search — adding a property database
- SharePoint 2010 : Scaling out Search — adding a query component
- SharePoint 2010 : Managing Search Service
- SharePoint 2010 : Setting up Search Service
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us