I created a IIS website, the application pool name is testAppPool.
Then I run the following code in the website, obtain current user group permissions:
WindowsIdentity winIdentity = WindowsIdentity.GetCurrent();
str += "<br/>Current user name:\t" + winIdentity.Name;
str += "<br/>Current user authentication type:\t" + winIdentity.AuthenticationType;
str += "<br/>Current user SID:\t" + winIdentity.User;
str += "<br/>Current user token:\t" + winIdentity.Token;
str += "<br/>Token owner SID:\t" + winIdentity.Owner;
str += $"<br/>Current user has {winIdentity.Groups.Count} group memberships.";
foreach (IdentityReference group in winIdentity.Groups)
{
NTAccount ntAcc = (NTAccount)group.Translate(typeof(NTAccount));
str += $"<br/> Group : {ntAcc.Value} ";
}
I got this result like this:
Current user name: IIS APPPOOL\test
Current user authentication type: Negotiate
Current user SID: S-1-5-82-2084461697-3881244625-4442817516-662440669-514472240
Current user token: 2080
Token owner SID: S-1-5-82-2084461697-3881244625-4442817516-662440669-514472240
Current user has 9 group memberships.
Group : Everyone
Group : BUILTIN\Users
Group : NT AUTHORITY\SERVICE
Group : CONSOLE LOGON
Group : NT AUTHORITY\Authenticated Users
Group : NT AUTHORITY\This Organization
Group : BUILTIN\IIS_IUSRS
Group : LOCAL
Group : 【SID: S-1-5-82-0】
It contains the user group BUILTIN\Users, and I found that IIS APPPOOL\test can access all disks, read and modify.
But I found that IIS APPPOOL\test isn't in the Users Group of Computer Management.
How can I remove the IIS APPPOOL\test account from BUILTIN\Users group.
thanks very much.