SQL Server 2016 Permissions – Unable to Revoke ‘NT AUTHORITY\SYSTEM’

permissionssql serversql-server-2016

I have tried everything I know to do and spent several hours Googling without success. I want to revoke the SHUTDOWN and CONTROL SERVER permissions for the login NT AUTHORITY\SYSTEM.

When I run this

EXECUTE AS LOGIN = 'NT AUTHORITY\SYSTEM'
SELECT * FROM fn_my_permissions(NULL,NULL)
REVERT

…the output is:

enter image description here

Things I have tried:

Deleting the Login entirely,
Executing the following (with the different permissions listed):

USE master;  
REVOKE SHUTDOWN FROM "NT AUTHORITY\SYSTEM";
GO

Even after I delete the login, and execute the fn_my_permissions SP, it still lists the permissions from the image above.

Any help I could get on this would be great.

Best Answer

This should revoke the permissions

REVOKE CONTROL SERVER TO [NT AUTHORITY\SYSTEM]
REVOKE SHUTDOWN TO [NT AUTHORITY\SYSTEM]

Tests

use [master]
GO
GRANT CONTROL SERVER TO [NT AUTHORITY\SYSTEM]
GO
use [master]
GO
GRANT SHUTDOWN TO [NT AUTHORITY\SYSTEM]
GO

EXECUTE AS LOGIN = 'NT AUTHORITY\SYSTEM'
SELECT * FROM fn_my_permissions(NULL,NULL)
REVERT

Result

enter image description here

... (34 Results)

REVOKE CONTROL SERVER TO [NT AUTHORITY\SYSTEM]
REVOKE SHUTDOWN TO [NT AUTHORITY\SYSTEM]

EXECUTE AS LOGIN = 'NT AUTHORITY\SYSTEM'
SELECT * FROM fn_my_permissions(NULL,NULL)
REVERT

Result

enter image description here


Extra info

If you are ever unsure about the syntax, an easy one (in my opinion), is selecting what you need inside of the GUI and then scripting it out using the 'script' button.

For example in this answer, I added the grants for the CONTROL SERVER and SHUTDOWN to the login NT AUTHORITY\SYSTEM , Scripted it out, and then removed them in the GUI and scripted them out again to get the revoke statements. I am against executing stuff through the GUI though, since it is easy to overlook things, and it has proven to be buggy.

enter image description here