On my previous FreePBX 16 server I had a number of custom PHP files in /var/www/html, files that create a phone book, does caller ID lookups, those kind of scripts. I used to log into the server as root so I was able to make changes wherever I wanted. I also connected using a text editor (Dreamweaver, SFTP) to edit these files. Since moving to Debian/FreePBX 17 I have been using another user as it’s not recommended using root (of course) so when login in using my text editor a rights issue occurs as the files I’m looking to edit are owned by asterisk and not by my user. This prevents me from editing the files. I have changed the ownership of the custom files to my user, but after every reload, the ownerships are reverted to asterisk.
What is the best way to go about this without having to change the owner every time?
Login as the asterisk use and that solves your problems. The asterisk user owns /var/www/html, you didn’t notice this previously because being root lets you edit any file owned by anyone. The system would have still run a chown and put those file ownerships back to asterisk on the old system.
You can select whatever you whant as text editor.
You can set it up to call Visual Code, …etc.
By default, it’s internal editor, but you can change it.
Not logging in as root is more about traceability than not having a root shell. You can use su or sudo, once you have identified yourself.
Ideally, though, you would have the files with group asterisk and have that as an auxiliary group on your account. However I’m not sure if FreePBX handles group and permission in a way that allows that. (Logging in as asterisk has the traceability issues associated with logging in as root.)