Recent

Author Topic: [Solved]Admin rights  (Read 940 times)

Ten_Mile_Hike

  • New Member
  • *
  • Posts: 49
[Solved]Admin rights
« on: March 19, 2023, 09:33:28 pm »
******************Situation**************************
On Win11 using Tfilestream I cannot write to the the drive root "C:\" unless
1)  I start Lazarus "As Admin"
               OR
2)  I Run my program outside Lazarus "As Admin"

I tried the project option of "Require Admin". I also used the "sharedenynone" parameter, but
neither gave me access to write to "C:\" either.

Doing either of #1 or #2 above is easy and works fine, but I AM LAZY so I am now starting Lazarus from a
shortcut that gives Admin rights to Lazarus on every startup. This works fine and gives me access to write to "C:\"

*************************My Question******************
Are there any downsides / unexpected "Gotchas"  to starting Lazarus every time as "Admin" by default as I have done???
« Last Edit: March 20, 2023, 05:17:14 am by Ten_Mile_Hike »

440bx

  • Hero Member
  • *****
  • Posts: 4014
Re: Admin rights
« Reply #1 on: March 19, 2023, 10:27:28 pm »
*************************My Question******************
Are there any downsides / unexpected "Gotchas"  to starting Lazarus every time as "Admin" by default as I have done???
Yes, there are a few, among them:  any program you start from an elevated program, i.e, one that has admin rights, also has admin rights, which means that the program can delete and/or modify .exe or .dlls that it normally would not have access to.  This applies to your own programs when you're debugging them.

All that said, the risk is low as long as you exercise a minimum amount of care.  It should also be mentioned that sometimes it is necessary to start Lazarus with admin rights when using GDB to debug a program you've written if that program needs admin rights to do whatever it's supposed to do (otherwise UAC starts a new elevated instance which is not the one expected by GDB making GDB very unhappy. Note: this may (should?) also happen with fpdebug.)

For the record, most of the time I run Lazarus and a few other programs with admin rights, particularly those I trust because I've been using them for a long time.  I find the UAC thing mostly annoying but I still like to have it in the background, just in case.

HTH.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Ten_Mile_Hike

  • New Member
  • *
  • Posts: 49
Re: Admin rights
« Reply #2 on: March 20, 2023, 05:16:42 am »
@440bx Thanks

 

TinyPortal © 2005-2018