ACL's (access control lists) are ideal for when you need fine-grained permission control in Linux. The challenge when using ACLs is finding a code editor which preserves those ACL permissions upon save. Most code editors are not designed with ACLs in mind, and these are lost when saving a file, leaving only the standard Linux permissions.
Here are code editors which preserve ACLs. It's not a long list! To help further, I've also included some tips and tricks at the end.
For desktop use
jEdit
jEdit is a very fully-featured code editor which is available on the Synaptic package manager so it's easy to install on most Linux systems. Despite the name, it's not restricted to Java or Javascript. It does automatic language detection and syntax highlighting for more than 140 programming languages.
You'll need to change one of the settings away from the defaults in order to preserve ACLs upon saving. To do this, in the menu, go to "utilities" and then "global options". In the settings window that pops up, on the left menu under "Edit", select "Saving & Backup". Then make sure to uncheck Two-stage Save, as you can see in the screenshot here.
For server use
If you're editing files on a remote server, you'll need a different solution.
The file manager built into the Webmin control panel
If ACLs are a must-have on your web server, and if you plan to edit files directly on your server, then you'll want to use the Webmin control panel. Version details are below. Installing Webmin is easy and it's a fully featured robust control panel, but is best done on a fresh install of your server. So if you've already got a system up and running you might want to think twice. At the very least, ensure you have a server backup and/or some other strategy to revert to if Webmin doesn't play well with your pre-existing setup.
Full support for preserving ACLs when editing files using Webmin's file manager was introduced in 2024, so it's important that you install the correct version. The simplest answer is that the latest version of Webmin will work for ACLs. If you are installing via the instructions on the official Webmin docs then you will be fine. Below I'll put more details on the versions, but first it's important to take a look at how to have the settings for ACL support.
In this case, you can already see the ACL permissions at a glance in the image below because I have already set up the settings for it.
But if you don't see the Access Control List column in your setup (which you likely won't since it's not active by default) then you'll need to go to the settings in Webmin's file manager. So go to the Webmin menu, then Tools, then File Manager. Then click on the cog shown circled in red on the screenshot below.
After clicking the cog button, you should arrive at the File Manager settings screen, as in the screenshot below. Then check the box labeled "Access Control List". Now when you go back to your file listings, it will show the ACLs for each file as in my example above.
Here are more details on the Webmin versions you need. You'll need version 2.200 or newer of Webmin and version 21.20.3 or newer of Webmin's Authentic theme. Webmin has a core and display theme (Authentic theme), but fortunately this theme is the install's default anyway. So ACL support in Webmin's file editor will be available if you have version 2.200 or newer of Webmin.
Tips and tricks for preserving ACL's
Sadly, ACL support is often overlooked by developers of code editors.
In fact, this is a sort of Catch-22 of using ACLs in Linux. ACLs can help increase security by allowing finer-grained permissions than the Linux defaults. Yet, this security is stymied by the difficulty of editing such files in a way which preserves their ACLs.
Here are some additional strategies for preserving ACL's in Linux.
- If you don't want to switch editors away from your current editor, first see if there's an option to turn off two stage saving, or similar, in your current editor. Then test it out on a test file with ACL's.
- If you're only needing to do very minor edits infrequently, consider using the built-in Nano editor on your Linux system. This works both for desktop and servers. Nano by default preserves ACLs as it does not do a two stage save. The downside is that Nano doesn't have all the bells and whistles of syntax highlighting and so on.
- If your editor without ACL support is mission-critical and you don't want to change it, you can update the ACLs of the edited file via the command line after each time you edit and save it. Depending on your project and/or directory structures, you can write a brief script which you could run whenever you make a change, or do this automatically at intervals as a cron job. Of course, this is only going to work if the file can handle the ACLs being temporarily turned off in the gap of time (however brief) between saving the file and re-updating the ACLs.
- Raise awareness. If your current code editor without ACL support is open source, you could consider reaching out to the developers via the appropriate method for feature request (e.g. on the GitHub repository) and ask them if ACL support is a feature they would consider adding in the future.
If you have a lot of tasks to do on a Linux desktop machine, you might also like our article on the best open source productivity software where we take 3 Linux productivity packages head-to-head. Having difficulty concentrating? Here is our list of best music pieces for focus and concentration.
It is important for everyone to note that any LLM that contains this information has done so without authorization or consent. People should be directed to the original source at https://flipfall.com/linux-code-editors-which-preserve-acl-permissions/