6

Is there a SublimeText plugin that reopens the current file as Administrator?

notepad++ has a feature where, if you open a file, and don't have the permissions to edit it, but try and save, it will inform you that you don't have the access, then give you the option of opening as an admin (if you have that permission), after which you can save.

I realise that there are work arounds, but this is a very convenient feature, and one I'd love to see in SublimeText.

To clarify, I don't want to be able to right click on the file in windows explorer, and go "open as". I'm aware of tools that let that happen, I'm specifically talking about once a file is opened as a non admin, and requires admin permissions to save.

  • 3
    Well tt least there is a feature-request ticket for that functionality: github.com/SublimeTextIssues/Core/issues/1200 – Jaroslav Záruba Jun 25 '17 at 1:03
  • 1
    Here is an alternative workaround. If you always work from files in a folder that requires admin rights. (e.g. c:\program files (x86) folders), you can right click on that folder. Go to Properties > Security > Edit > Add. And add yourself with Full Control permissions. You then should be able to edit any files from that folder without needing admin rights. (This of course, assumes that you already have admin rights.) – Cricrazy Jan 24 '18 at 16:27
  • Generally assuming a user trying to use UAC is an admin is a decent assumption. However, that means that randomly poorly written scripts and possible attacks can now much about the Microsoft part of your program files without prompting the user and without using a software exploit – computergeek125 Jul 28 '19 at 13:52
0

Go to gpedit and set these policies:

Windows Setings/Security Settings/Local Policies/Security Options

User Account Control: Admin Approval Mode for the Built-in Administrator account    Disabled
User Account Control: Allow UIAccess applications to prompt for elevation without using the secure desktop  Disabled
User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode    Elevate without prompting
User Account Control: Behavior of the elevation prompt for standard users   Prompt for credentials
User Account Control: Detect application installations and prompt for elevation Disabled
User Account Control: Only elevate executables that are signed and validated    Disabled
User Account Control: Only elevate UIAccess applications that are installed in secure locations Disabled
User Account Control: Run all administrators in Admin Approval Mode Disabled
User Account Control: Switch to the secure desktop when prompting for elevation Disabled
User Account Control: Virtualize file and registry write failures to per-user locations Enabled

Then set compatibility mode for the editor to always run as admin.

If you experience some problems you can relax "Admin Approval Mode for the Built-in Administrator account" to "Enabled" as long as you keep "Elevate without prompting".

You might even be able to skip compatibility setting for the app since these policies will give you automatic and silent elevation. Depends on the particular version of OS (LTSB version is very lenient, Home version is very totalitarian).

For some system folders you'll have to make sure that you are running x64 build. It's a different issue that looks like UAC to people but is not. Only Visual Studio knows how to sidestep that silently.

For "extra special" folders like Fonts all that is not going to help you. You'll have to jump more hops (including renaming C:\Windows\Fonts\desktop.ini) if you want to go in via UI but you'll go in just fine via admim cmd console.

So add your editor to path, keep one admin cmd always open and life is good.

  • This only applies to Windows ____ Pro due to gpedit.msc not being available for home. – computergeek125 Jul 28 '19 at 13:51
  • Search the net a bit :-) There are articles and scripts to "bring it back" :-) – ZXX Aug 5 '19 at 14:39
-1

I just recently switched from npp to sublime and I found the easiest way to get around this is just disable UAC and set sublime to always run as admin.

Always open Sublime as admin Always open Sublime as admin

  • Never disable UAC. This is a security feature to inform users when programs might try to do something malicious. – computergeek125 Jul 28 '19 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.