Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    sudo notepad-plus-plus (in Linux of course)

    Help wanted · · · – – – · · ·
    2
    4
    121
    Loading More Posts
    • 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.
    • D
      Dave92F1 last edited by

      I installed NP++ from Canonical’s Snap Store (makes it really easy; it sets up Wine for you automatically, etc.).

      It works fine for normal files, but for files that require root permission I have trouble.

      For example, to edit such a file with nano I’d do:

      sudo nano /etc/rc.local
      

      If I try that with NP++, I get this:

      dave@MONOLITH:~$ sudo notepad-plus-plus /etc/rc.local
      mkdir: cannot create directory '/run/user/0': Permission denied
      Authorization required, but no authorization protocol specified
      Starting application..
      

      And the program doesn’t start.

      How can I make this work?

      PeterJones 1 Reply Last reply Reply Quote 0
      • PeterJones
        PeterJones @Dave92F1 last edited by PeterJones

        @Dave92F1 ,

        There aren’t many experts in using Notepad++ on Wine here (I used to know of one, but that person left years ago), and the official policy of Notepad++ is that only Windows is supported (and that, only 8.1 and newer).

        You having permission to sudo nano but not sudo notepad-plus-plus isn’t as informative as if you’d proven you can sudo another Wine-based application. My guess is that you should check a Wine-specific forum for how to sudo an application from Wine, and make sure that all works, then compare those results to doing the same thing for Notepad++.

        However, searching for your error (wine mkdir: cannot create directory '/run/user/0': Permission denied Authorization required, but no authorization protocol specified Starting application..) on The Search Engine That Knows All found this github issue report in an unrelated repo, where the user got that error message in a GitHub Action runner. Skimming down the replies, someone said “unfortunately it’s a known issue with snap packages”. Since you said you got it from Canonical’s Snap Store, that makes me thing that you’ve run across a known issue with Snap packages (whatever those are), which presumably has nothing to do with Notepad++ specifically, but rather the way you are installing and running it. Reading the exerpts from other results I saw from my search seem to indicate the other hits are probably pointing in the same Snap-is-the-culprit direction. If you do more internet searches along those lines, you may find other results that maybe have workarounds to try.

        Good luck

        D 1 Reply Last reply Reply Quote 2
        • D
          Dave92F1 @PeterJones last edited by Dave92F1

          @PeterJones Thanks. Elsewhere I’ve been advised that “the only way” to do this is to take ownership of the file, edit it, then restore ownership back to root. I’m not sure if that’s practical (I’d have to find a way to do it in a script). I was hoping the NP++ community would have experience with this, since I gather that NP++_on_Wine is sort of the “official” way to run NP++ on Linux.

          If I have to move off of NP++, I’ll really miss it.

          PeterJones 1 Reply Last reply Reply Quote 0
          • PeterJones
            PeterJones @Dave92F1 last edited by PeterJones

            @Dave92F1,

            I was hoping the NP++ community would have experience with this, since I gather that NP++_on_Wine is sort of the “official” way to run NP++ on Linux.

            Notepad++ is an application for Windows ; no other usage is official nor even “official”. If you can get it to work in another environment (like Wine), then lucky you.

            Elsewhere I’ve been advised that “the only way” to do this is to take ownership of the file, edit it, then restore ownership back to root. I’m not sure if that’s practical (I’d have to find a way to do it in a script).

            I am not a linux-sudo expert, but the sudo permissions should be sufficient to run a script that changes the owner of a file, makes a change, then changes it back – at least, I cannot imagine how that wouldn’t work, since root (and thus sudo) has the ability to change permissions on any file. I mean, if I’ve understood correctly, the script could probably be as simple as

            sudo chown username /etc/rc.local
            notepad-plus-plus /etc/rc.local
            sudo chown root /etc/rc.local
            

            Do not take my word as “golden” or “authoritative” or “official” on this. I’ve never done such a thing. And there are probably security implications of changing the owner, even temporarily.

            ----
            edit: Ooh, another idea: copy it to a temp file before changing permission, so no one else ever has permission on the real file

            sudo cp /etc/rc.local /tmp/editable.rc.local
            sudo chown username /tmp/editable.rc.local
            notepad-plus-plus /tmp/editable.rc.local
            sudo chown root /tmp/editable.rc.local
            cp /tmp/editable.rc.local /etc/rc.local 
            

            That might be better, though there are probably still security considerations on that. Using a meaningless/random tmpfile name would probably be better than /tmp/editable.rc.local, so that it’s not obvious to an outsider watching the /tmp filestructure that the file is being used for editing rc.local

            1 Reply Last reply Reply Quote 1
            • First post
              Last post
            Copyright © 2014 NodeBB Forums | Contributors