Ghost Doctor can't check folder permissions

So… ghost doctor will return that it can’t check folder permissions. It is failing on the content directory that is owned by the user ghost. I’ve tried all kinds of different permissions for it but finally changed its owner with chown to my non sudo user. Then ghost doctor works and checks permissions in it properly, but it won’t upgrade it because content directory must be owned by ghost.

This feels like a bug? Running Ubuntu 22.04…

Here is the output I have

carlgallagher@srv:~/webapps/app-de-mainsite$ ghost doctor

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org


✔ Checking system Node.js version - found v18.16.0
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking system compatibility
Local MySQL install was not found or is stopped. You can ignore this if you are using a remote MySQL host.
Alternatively you could:
a) install/start MySQL locally
b) run `ghost install --db=sqlite3` to use sqlite
c) run `ghost install local` to get a development install using sqlite3.
? Continue anyway? Yes
MySQL check skipped
ℹ Checking for a MySQL installation [skipped]
+ sudo systemctl is-active ghost_digitallyevolved-net
Instance is currently running
ℹ Validating config [skipped]
✖ Checking folder permissions
✖ Checking file permissions
✖ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking free space
✔ Checking systemd unit file
✔ Checking systemd node version - found v18.16.0
One or more errors occurred.

1) Checking folder permissions

Message: Ghost can't access some files or directories to check for correct permissions.
Help: Run sudo find ./ -type d -exec chmod 00775 {} \; and try again.


2) Checking file permissions

Message: Ghost can't access some files or directories to check for correct permissions.
Help: Run sudo find ./ -type d -exec chmod 00775 {} \; and try again.


3) Checking content folder ownership

Message: Ghost can't access some files or directories to check for correct permissions.
Help: Run sudo find ./ -type d -exec chmod 00775 {} \; and try again.

Debug Information:
    OS: Ubuntu, v22.04.2 LTS
    Node Version: v18.16.0
    Ghost Version: 5.47.0
    Ghost-CLI Version: 1.24.0
    Environment: production
    Command: 'ghost doctor'

Try running ghost doctor to check your system for known issues.

You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.
carlgallagher@srv:~/webapps/app-de-mainsite$ sudo ghost doctor
You can't run commands as the 'root' user.
Switch to your regular user, or create a new user with regular account privileges and use this user to run 'ghost doctor'.
For more information, see https://ghost.org/docs/install/ubuntu/#create-a-new-user.

carlgallagher@srv:~/webapps/app-de-mainsite$ sudo find ./ -type d -exec chmod 00775 {} \;
carlgallagher@srv:~/webapps/app-de-mainsite$ ghost doctor

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org


✔ Checking system Node.js version - found v18.16.0
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking system compatibility
Local MySQL install was not found or is stopped. You can ignore this if you are using a remote MySQL host.
Alternatively you could:
a) install/start MySQL locally
b) run `ghost install --db=sqlite3` to use sqlite
c) run `ghost install local` to get a development install using sqlite3.
? Continue anyway? Yes
MySQL check skipped
ℹ Checking for a MySQL installation [skipped]
+ sudo systemctl is-active ghost_digitallyevolved-net
Instance is currently running
ℹ Validating config [skipped]
✖ Checking folder permissions
✖ Checking file permissions
✖ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking free space
✔ Checking systemd unit file
✔ Checking systemd node version - found v18.16.0
One or more errors occurred.

1) Checking folder permissions

Message: Ghost can't access some files or directories to check for correct permissions.
Help: Run sudo find ./ -type d -exec chmod 00775 {} \; and try again.


2) Checking file permissions

Message: Ghost can't access some files or directories to check for correct permissions.
Help: Run sudo find ./ -type d -exec chmod 00775 {} \; and try again.


3) Checking content folder ownership

Message: Ghost can't access some files or directories to check for correct permissions.
Help: Run sudo find ./ -type d -exec chmod 00775 {} \; and try again.

Debug Information:
    OS: Ubuntu, v22.04.2 LTS
    Node Version: v18.16.0
    Ghost Version: 5.47.0
    Ghost-CLI Version: 1.24.0
    Environment: production
    Command: 'ghost doctor'

Try running ghost doctor to check your system for known issues.

You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.
carlgallagher@srv:~/webapps/app-de-mainsite$

Have you tried following the instructions in the message?

In the log file you can see I ran the command that it suggested and it did not resolve the issue.

If I run the command without the chmod or sudo it says it cannot modify or read the content folder. The issue is that my user cannot interact with the folder named content that is owned by ghost group and user, and when I run ghost doctor it runs as my user who has no permission to the content folder. I cannot run ghost doctor as sudo because that is forbidden.

Now that I think about it… does my user need to be part of the ghost group? If so, is this a failure in the setup? I did not see any instruction to add my user to the ghost group.

Edit: Adding the user to the ghost group presented a clear ghost doctor output. Will this present an issue with security later on?

carlgallagher@srv:~/webapps/app-de-mainsite$ groups
carlgallagher sudo users-rc
carlgallagher@srv:~/webapps/app-de-mainsite$ sudo usermod -a -G carlgallagher,sudo,users-rc,ghost carlgallagher
carlgallagher@srv:~/webapps/app-de-mainsite$ groups
carlgallagher sudo users-rc
carlgallagher@srv:~/webapps/app-de-mainsite$ exit
exit
root@srv:~# sudo su carlgallagher
carlgallagher@srv:/root$ groups
carlgallagher sudo ghost users-rc
carlgallagher@srv:/root$ cd ~
carlgallagher@srv:~$ cd webapps/app-de-mainsite/
carlgallagher@srv:~/webapps/app-de-mainsite$ ls
config.production.json  content  current  versions
carlgallagher@srv:~/webapps/app-de-mainsite$ ghost doctor

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org


✔ Checking system Node.js version - found v18.16.0
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking system compatibility
Local MySQL install was not found or is stopped. You can ignore this if you are using a remote MySQL host.
Alternatively you could:
a) install/start MySQL locally
b) run `ghost install --db=sqlite3` to use sqlite
c) run `ghost install local` to get a development install using sqlite3.
? Continue anyway? Yes
MySQL check skipped
ℹ Checking for a MySQL installation [skipped]
+ sudo systemctl is-active ghost_digitallyevolved-net
Instance is currently running
ℹ Validating config [skipped]
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking free space
✔ Checking systemd unit file
✔ Checking systemd node version - found v18.16.0
carlgallagher@srv:~/webapps/app-de-mainsite$