Question about editing and saving files that are currently read only
-
I need to edit some Mastodon files but I keep getting a read only error in the terminal. :w! doesn't work. I also tried to chmod write permission to the file but it's a no go. How do I write the file after I've made changes? The files that I need to change are not available in the File Manager.
-
@ScottyMojo in short, you can't.
The read only file sysyem is why updates, backups, cloning etc Just Work on Cloudron.
-
If you want to make temporary changes that will revert on every App restart & upgrade, you can make those read-only changes in
Recovery
mode, which is in the Repair section of the App settings.If you mention the files you want to modify and an acceptable use case, there is a potential to generate a feature request to have the files exposed for editing in a future package update.
Otherwise security is paramount and the read-only filesystem is a major part of that architecture.
-
I read that trying to tie in the Cloudron user management doesn't work very well so during installation, I selected to let all of the user management be handled by Mastodon. The side effect to this is that I would like to create "admin" as a username for my admin account. However, in 4.x, there are reserved usernames that aren't allowing an account with the username to be created. After reading various posts, it sounds like I need to edit reserved_usernames in config/settings.yml.
I also need to edit the media_attachment.rb file located in app/models/
Thus far, I think those are the only files that I need to edit but I was wanting to play with the theme files too.
Is it possible for me to open SSH as root from my Digital Ocean droplet and edit / write the files? If so, where is the Mastodon installation located? I can't find it. Do I need to chmod the file first and if so, is chmod +rwx filename the correct permissions?
Thank you greatly for your guidance!
-
To elaborate a bit more on the username issue, I also tried to manually create the "admin" username via command line but the reserved message displayed and couldn't create the account.
Here is the example that I tried:
RAILS_ENV=production bin/tootctl accounts create
alice
--email alice@example.com
--confirmed
--role OwnerHowever, please note that this is just the example. I replaced the username and email address accordingly.
From the sounds of things, I need to edit the reserved_usernames in config/settings.yml which will hopefully let me create the account, then grant it admin privileges via command line.
i.e.
RAILS_ENV=production bin/tootctl accounts modify alice --role admin
-
@ScottyMojo said in Question about editing and saving files that are currently read only:
Is it possible for me to open SSH as root from my Digital Ocean droplet and edit / write the files? If so, where is the Mastodon installation located? I can't find it. Do I need to chmod the file first and if so, is chmod +rwx filename the correct permissions?
As I mentioned you do this via Recovery mode which makes the filesystem temporarily writable.
From the UI, App Settings, Repair, Enter Recovery Mode.
Then you use the convenient Terminal button from the top right of App Settings and it opens a shell right into the App container in your browser. No need to ssh.
-
@ScottyMojo surprise, you were told earlier. If you can't make the changes while beeing in recovery mode, there is no way other then directly writing to the DB. I don't see the need nor your use case though and nothing speaks against an admin account that is named administrator (not reserved).
However, you can try to push #20695 so this gets added as a feature.
-
@ScottyMojo right, if you read the linked docs it says you need to start the app manually keeping recovery mode.