Required permissions to set Process.PriorityClass in Win 2003 serv

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Required permissions to set Process.PriorityClass in Win 2003 serv

    Hi All,

    I have an asp.net application that needs to set it's priority to normal, but
    I get access denied when the below code executes. The reason I have to do
    this is I use a third party com component and it changes the priority to
    high, so I want to bang it on the head to make it normal again.

    System.Diagnostics.Process process =
    System.Diagnostics.Process.GetCurrentProcess();
    process.PriorityClass = System.Diagnostics.ProcessPriorityClass.Normal;

    The code works just fine if the user has admin rights. I have also tried
    giving the user 'Act as part of the OS' and 'Increase scheduling priority' in
    local security settings and neither of these let it work. I should also
    mention that this bit of code works just fine on 2000/XP without changing any
    ASPNet permissions. To run on 2003 server I have also changed the
    application to impersonate a new local machine account.

    Does anyone know what permission the user needs to change the process
    priority?

    Cheers
    Paul

    Paul Roberts Guest

  2. Similar Questions and Discussions

    1. Required read/write permissions
      I have multiple sites that sit parallel to one another in a parent directory. All sites are controlled by Contribute Publishing Services, but each...
    2. COM+ Permissions problem migrating to Windows 2003
      Migrating a VC++ COM+ application to Windows 2003, and we are unable to get the app to startup except when the Identity user is given Administrator...
    3. Required permissions cannot be acquired?
      I've posted a similar question in the microsoft.public.sqlserver.reportingsvcs group, but I need to solve this and it is more of a .NET/permissions...
    4. ASP.NET, IIS 6.0 (Windows Server 2003) and Com permissions...
      I have an ASP.NET application that instantiantes a Win32 C++ Com object. This object's methods require specific access permissions to the...
    5. Required permissions cannot be acquired on a Win 2003 server...
      Hi, I've just installed the UDDI Service to test it and when I try to access the localhost/UDDI virtual folder I receive the Required...
  3. #2

    Default Re: Required permissions to set Process.PriorityClass in Win 2003 serv

    I have no problems setting the priority in this way on Windows 2003 when
    code is running from within the (unmodified) default application pool under
    the default NetworkService account. Are you receiving an exception or is
    the attempted change simply not appearing to have the desired effect? If
    the former, what is the exception?



    "Paul Roberts" <PaulRoberts@discussions.microsoft.com> wrote in message
    news:1DC14FF0-0F9E-492F-8801-DFBD68E4D4ED@microsoft.com...
    > Hi All,
    >
    > I have an asp.net application that needs to set it's priority to normal,
    > but
    > I get access denied when the below code executes. The reason I have to do
    > this is I use a third party com component and it changes the priority to
    > high, so I want to bang it on the head to make it normal again.
    >
    > System.Diagnostics.Process process =
    > System.Diagnostics.Process.GetCurrentProcess();
    > process.PriorityClass = System.Diagnostics.ProcessPriorityClass.Normal;
    >
    > The code works just fine if the user has admin rights. I have also tried
    > giving the user 'Act as part of the OS' and 'Increase scheduling priority'
    > in
    > local security settings and neither of these let it work. I should also
    > mention that this bit of code works just fine on 2000/XP without changing
    > any
    > ASPNet permissions. To run on 2003 server I have also changed the
    > application to impersonate a new local machine account.
    >
    > Does anyone know what permission the user needs to change the process
    > priority?
    >
    > Cheers
    > Paul
    >

    Nicole Calinoiu Guest

  4. #3

    Default Re: Required permissions to set Process.PriorityClass in Win 2003

    Paul,

    If the user is a member of the built-in Users group, the only additional
    privilege it should need is "Debug programs." However, as this is a rather
    risky one to grant to real users, you should probably only do this if the
    user in question in an account that is only used for the purpose of running
    your application. Otherwise, you might want to consider temporarily
    impersonating a user with this priviledge just for the purpose of altering
    the process priority.

    HTH,
    Nicole



    "Paul Roberts" <PaulRoberts@discussions.microsoft.com> wrote in message
    news:CD4EB68D-C197-4383-B513-BCDF1E96B859@microsoft.com...
    > Hi Nicole,
    >
    > My appliation is also running under the default application pool under the
    > default networkservice account. The error that I am getting is 'Access is
    > denied', this is the stack trace that I am getting.
    >
    > Error Message: Access is denied
    > Error Source: System
    > Stack Trace:
    > at System.Diagnostics.ProcessManager.OpenProcess(Int3 2 processId, Int32
    > access, Boolean throwIfExited)
    > at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean
    > throwIfExited)
    > at System.Diagnostics.Process.GetProcessHandle(Int32 access)
    > at System.Diagnostics.Process.set_PriorityClass(Proce ssPriorityClass
    > value)
    >
    > As I mentioned in the original post my application is using impersonation
    > so
    > it can connect to the database and this call will also be happening under
    > that account. So I think there is some permission that I grant the
    > account
    > to make this work. If I give the account admin rights it also works, but
    > not
    > a very good solution.
    >
    > Cheers
    > Paul
    >
    > "Nicole Calinoiu" wrote:
    >
    >> I have no problems setting the priority in this way on Windows 2003 when
    >> code is running from within the (unmodified) default application pool
    >> under
    >> the default NetworkService account. Are you receiving an exception or is
    >> the attempted change simply not appearing to have the desired effect? If
    >> the former, what is the exception?
    >>
    >>
    >>
    >> "Paul Roberts" <PaulRoberts@discussions.microsoft.com> wrote in message
    >> news:1DC14FF0-0F9E-492F-8801-DFBD68E4D4ED@microsoft.com...
    >> > Hi All,
    >> >
    >> > I have an asp.net application that needs to set it's priority to
    >> > normal,
    >> > but
    >> > I get access denied when the below code executes. The reason I have to
    >> > do
    >> > this is I use a third party com component and it changes the priority
    >> > to
    >> > high, so I want to bang it on the head to make it normal again.
    >> >
    >> > System.Diagnostics.Process process =
    >> > System.Diagnostics.Process.GetCurrentProcess();
    >> > process.PriorityClass = System.Diagnostics.ProcessPriorityClass.Normal;
    >> >
    >> > The code works just fine if the user has admin rights. I have also
    >> > tried
    >> > giving the user 'Act as part of the OS' and 'Increase scheduling
    >> > priority'
    >> > in
    >> > local security settings and neither of these let it work. I should
    >> > also
    >> > mention that this bit of code works just fine on 2000/XP without
    >> > changing
    >> > any
    >> > ASPNet permissions. To run on 2003 server I have also changed the
    >> > application to impersonate a new local machine account.
    >> >
    >> > Does anyone know what permission the user needs to change the process
    >> > priority?
    >> >
    >> > Cheers
    >> > Paul
    >> >
    >>
    >>
    >>

    Nicole Calinoiu Guest

  5. #4

    Default Re: Required permissions to set Process.PriorityClass in Win 2003

    Hi Nicole,

    I tried giving the user the 'Debug programs' privilege, but that didn't seem
    to help at all.

    I have now managed to make it work by changing the default aplication pool
    to run as my new user account and adding the account to the IIS_WPG group. I
    don't like this solution that much but at least it is now working. If anyone
    else has any other ideas they would be appreciated.

    Thanks for your help.

    Cheers
    Paul

    "Nicole Calinoiu" wrote:
    > Paul,
    >
    > If the user is a member of the built-in Users group, the only additional
    > privilege it should need is "Debug programs." However, as this is a rather
    > risky one to grant to real users, you should probably only do this if the
    > user in question in an account that is only used for the purpose of running
    > your application. Otherwise, you might want to consider temporarily
    > impersonating a user with this priviledge just for the purpose of altering
    > the process priority.
    >
    > HTH,
    > Nicole
    >
    >
    >
    > "Paul Roberts" <PaulRoberts@discussions.microsoft.com> wrote in message
    > news:CD4EB68D-C197-4383-B513-BCDF1E96B859@microsoft.com...
    > > Hi Nicole,
    > >
    > > My appliation is also running under the default application pool under the
    > > default networkservice account. The error that I am getting is 'Access is
    > > denied', this is the stack trace that I am getting.
    > >
    > > Error Message: Access is denied
    > > Error Source: System
    > > Stack Trace:
    > > at System.Diagnostics.ProcessManager.OpenProcess(Int3 2 processId, Int32
    > > access, Boolean throwIfExited)
    > > at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean
    > > throwIfExited)
    > > at System.Diagnostics.Process.GetProcessHandle(Int32 access)
    > > at System.Diagnostics.Process.set_PriorityClass(Proce ssPriorityClass
    > > value)
    > >
    > > As I mentioned in the original post my application is using impersonation
    > > so
    > > it can connect to the database and this call will also be happening under
    > > that account. So I think there is some permission that I grant the
    > > account
    > > to make this work. If I give the account admin rights it also works, but
    > > not
    > > a very good solution.
    > >
    > > Cheers
    > > Paul
    > >
    > > "Nicole Calinoiu" wrote:
    > >
    > >> I have no problems setting the priority in this way on Windows 2003 when
    > >> code is running from within the (unmodified) default application pool
    > >> under
    > >> the default NetworkService account. Are you receiving an exception or is
    > >> the attempted change simply not appearing to have the desired effect? If
    > >> the former, what is the exception?
    > >>
    > >>
    > >>
    > >> "Paul Roberts" <PaulRoberts@discussions.microsoft.com> wrote in message
    > >> news:1DC14FF0-0F9E-492F-8801-DFBD68E4D4ED@microsoft.com...
    > >> > Hi All,
    > >> >
    > >> > I have an asp.net application that needs to set it's priority to
    > >> > normal,
    > >> > but
    > >> > I get access denied when the below code executes. The reason I have to
    > >> > do
    > >> > this is I use a third party com component and it changes the priority
    > >> > to
    > >> > high, so I want to bang it on the head to make it normal again.
    > >> >
    > >> > System.Diagnostics.Process process =
    > >> > System.Diagnostics.Process.GetCurrentProcess();
    > >> > process.PriorityClass = System.Diagnostics.ProcessPriorityClass.Normal;
    > >> >
    > >> > The code works just fine if the user has admin rights. I have also
    > >> > tried
    > >> > giving the user 'Act as part of the OS' and 'Increase scheduling
    > >> > priority'
    > >> > in
    > >> > local security settings and neither of these let it work. I should
    > >> > also
    > >> > mention that this bit of code works just fine on 2000/XP without
    > >> > changing
    > >> > any
    > >> > ASPNet permissions. To run on 2003 server I have also changed the
    > >> > application to impersonate a new local machine account.
    > >> >
    > >> > Does anyone know what permission the user needs to change the process
    > >> > priority?
    > >> >
    > >> > Cheers
    > >> > Paul
    > >> >
    > >>
    > >>
    > >>
    >
    >
    >
    Paul Roberts Guest

  6. #5

    Default Re: Required permissions to set Process.PriorityClass in Win 2003

    Paul,

    Granting the debug programs privilege does work, but privileges are only
    granted when a user token is first created, so you need to make sure that
    you allow the token to be re-created before you test the change. One
    sure-fire way is to reboot the server. Recycling the application pool is
    not sufficient to pick up the changed token. (If rebooting isn't an option,
    waiting a few minutes without any calls to the application will usually work
    as well. However, I don't recommend this for testing since you won't know
    if you waited long enough if a new call fails.)

    That said, I still don't think that granting this additional privilege just
    for the sake of changing the priority is necessarily a good idea.
    Personally, I'd opt for running the application in its own pool even if the
    security issue weren't a consideration since the other applications in the
    default pool (or any other potential shared pool) should almost certainly
    not be subjected to the priority switching in the first place. Is there any
    reason you couldn't move the application into its own pool, configuring the
    new pool to run in the context of your "special" account (or granting the
    user debug programs privilege or impersonating a more privileged user just
    to change the priority)?

    Nicole




    "Paul Roberts" <PaulRoberts@discussions.microsoft.com> wrote in message
    news:76AA81AB-AF94-4BD1-BDC0-0A83F9B94F15@microsoft.com...
    > Hi Nicole,
    >
    > I tried giving the user the 'Debug programs' privilege, but that didn't
    > seem
    > to help at all.
    >
    > I have now managed to make it work by changing the default aplication pool
    > to run as my new user account and adding the account to the IIS_WPG group.
    > I
    > don't like this solution that much but at least it is now working. If
    > anyone
    > else has any other ideas they would be appreciated.
    >
    > Thanks for your help.
    >
    > Cheers
    > Paul
    >
    > "Nicole Calinoiu" wrote:
    >
    >> Paul,
    >>
    >> If the user is a member of the built-in Users group, the only additional
    >> privilege it should need is "Debug programs." However, as this is a
    >> rather
    >> risky one to grant to real users, you should probably only do this if the
    >> user in question in an account that is only used for the purpose of
    >> running
    >> your application. Otherwise, you might want to consider temporarily
    >> impersonating a user with this priviledge just for the purpose of
    >> altering
    >> the process priority.
    >>
    >> HTH,
    >> Nicole
    >>
    >>
    >>
    >> "Paul Roberts" <PaulRoberts@discussions.microsoft.com> wrote in message
    >> news:CD4EB68D-C197-4383-B513-BCDF1E96B859@microsoft.com...
    >> > Hi Nicole,
    >> >
    >> > My appliation is also running under the default application pool under
    >> > the
    >> > default networkservice account. The error that I am getting is 'Access
    >> > is
    >> > denied', this is the stack trace that I am getting.
    >> >
    >> > Error Message: Access is denied
    >> > Error Source: System
    >> > Stack Trace:
    >> > at System.Diagnostics.ProcessManager.OpenProcess(Int3 2 processId, Int32
    >> > access, Boolean throwIfExited)
    >> > at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean
    >> > throwIfExited)
    >> > at System.Diagnostics.Process.GetProcessHandle(Int32 access)
    >> > at System.Diagnostics.Process.set_PriorityClass(Proce ssPriorityClass
    >> > value)
    >> >
    >> > As I mentioned in the original post my application is using
    >> > impersonation
    >> > so
    >> > it can connect to the database and this call will also be happening
    >> > under
    >> > that account. So I think there is some permission that I grant the
    >> > account
    >> > to make this work. If I give the account admin rights it also works,
    >> > but
    >> > not
    >> > a very good solution.
    >> >
    >> > Cheers
    >> > Paul
    >> >
    >> > "Nicole Calinoiu" wrote:
    >> >
    >> >> I have no problems setting the priority in this way on Windows 2003
    >> >> when
    >> >> code is running from within the (unmodified) default application pool
    >> >> under
    >> >> the default NetworkService account. Are you receiving an exception or
    >> >> is
    >> >> the attempted change simply not appearing to have the desired effect?
    >> >> If
    >> >> the former, what is the exception?
    >> >>
    >> >>
    >> >>
    >> >> "Paul Roberts" <PaulRoberts@discussions.microsoft.com> wrote in
    >> >> message
    >> >> news:1DC14FF0-0F9E-492F-8801-DFBD68E4D4ED@microsoft.com...
    >> >> > Hi All,
    >> >> >
    >> >> > I have an asp.net application that needs to set it's priority to
    >> >> > normal,
    >> >> > but
    >> >> > I get access denied when the below code executes. The reason I have
    >> >> > to
    >> >> > do
    >> >> > this is I use a third party com component and it changes the
    >> >> > priority
    >> >> > to
    >> >> > high, so I want to bang it on the head to make it normal again.
    >> >> >
    >> >> > System.Diagnostics.Process process =
    >> >> > System.Diagnostics.Process.GetCurrentProcess();
    >> >> > process.PriorityClass =
    >> >> > System.Diagnostics.ProcessPriorityClass.Normal;
    >> >> >
    >> >> > The code works just fine if the user has admin rights. I have also
    >> >> > tried
    >> >> > giving the user 'Act as part of the OS' and 'Increase scheduling
    >> >> > priority'
    >> >> > in
    >> >> > local security settings and neither of these let it work. I should
    >> >> > also
    >> >> > mention that this bit of code works just fine on 2000/XP without
    >> >> > changing
    >> >> > any
    >> >> > ASPNet permissions. To run on 2003 server I have also changed the
    >> >> > application to impersonate a new local machine account.
    >> >> >
    >> >> > Does anyone know what permission the user needs to change the
    >> >> > process
    >> >> > priority?
    >> >> >
    >> >> > Cheers
    >> >> > Paul
    >> >> >
    >> >>
    >> >>
    >> >>
    >>
    >>
    >>

    Nicole Calinoiu Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139