Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Setting User Permissions?

Setting User Permissions?

Scheduled Pinned Locked Moved C#
questioncsharpsysadminwindows-adminsecurity
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wakkerjack
    wrote on last edited by
    #1

    I can connect to a remote registry using microsoft.win32 package.. but it only works if i have authentication.. and the only way i know how to get it is try to access the computer over the network and fill in the details:P how do i gain permission using c# code? :)

    L 1 Reply Last reply
    0
    • W wakkerjack

      I can connect to a remote registry using microsoft.win32 package.. but it only works if i have authentication.. and the only way i know how to get it is try to access the computer over the network and fill in the details:P how do i gain permission using c# code? :)

      L Offline
      L Offline
      LongRange Shooter
      wrote on last edited by
      #2

      By default, the CurrentPrincipal on the thread is GenericPrincipal. If you set the CurrentPrincipal to WindowsPrincipal it should be the same as doing a RunAs. You can access the property off of the current thread (System.Threading.Thread.CurrentPrincipal). You can also set this at the AppDomain level, but you can only do this once during the entire life of the application domain. By doing it at the domain level, you inherit the WindowsPrincipal througout all threads within that application domain.

      W 1 Reply Last reply
      0
      • L LongRange Shooter

        By default, the CurrentPrincipal on the thread is GenericPrincipal. If you set the CurrentPrincipal to WindowsPrincipal it should be the same as doing a RunAs. You can access the property off of the current thread (System.Threading.Thread.CurrentPrincipal). You can also set this at the AppDomain level, but you can only do this once during the entire life of the application domain. By doing it at the domain level, you inherit the WindowsPrincipal througout all threads within that application domain.

        W Offline
        W Offline
        wakkerjack
        wrote on last edited by
        #3

        ok im not too familiar with CurrentPrincipal.. so could i plz have a code example to show me how to pass credentials to a remote computer to access their registry :) thanks

        L 1 Reply Last reply
        0
        • W wakkerjack

          ok im not too familiar with CurrentPrincipal.. so could i plz have a code example to show me how to pass credentials to a remote computer to access their registry :) thanks

          L Offline
          L Offline
          LongRange Shooter
          wrote on last edited by
          #4

          Getting credentials to see if a user is in a particular role is easy. Passing credentials from one system to another to access registry information is not. If it was easy, we'd have one more security patch to be applied to Windows because it would be such an easy hack. If there were a real business justification for doing something like this, then about the only way I could think of was to have the user install an agent and access the agent via remoting. This signature left intentionally blank

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups