Problem Description:
When executing ghost install --no-stack
, an error appears when starting Ghost:
Message: The content folder is not owned by the current user.
Ensure the content folder has correct permissions and try again.
The specific situation is as follows:
[kevin@cube_hk_1 ghost]$ ghost install --no-stack
Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js
Running in development mode
┌────────────────────────────────────────────────── ────────────────────────────────────┐
│Warning: MySQL 8 will be the required database in the next major release of Ghost.│
│ Make sure your database is up to date to ensure forwards compatibility. │
└────────────────────────────────────────────────── ──────────────────────────────────────┘
You are running an outdated version of Ghost-CLI.
It is recommended that you upgrade before continuing.
Run `npm install -g ghost-cli@latest` to upgrade.
✔ Checking system Node.js version - found v16.17.1
✔ Checking logged in user
✔ Checking current folder permissions
ℹ Checking system compatibility [skipped]
✔ Checking for a MySQL installation
✔ Checking memory availability
✔ Checking free space
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v5.19.0
✔ Finishing install process
? Enter your blog URL: https://ifree.love
? Enter your MySQL hostname: localhost
? Enter your MySQL username: root
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: ghost_dev
✔ Configuring Ghost
✔ Setting up instance
+ sudo chown -R ghost:ghost /var/www/ghost/content
✔ Setting up "ghost" system user
? Do you wish to set up "ghost" mysql user? Yes
✔ Setting up "ghost" mysql user
Nginx configuration already found for this url. Skipping Nginx setup.
ℹ Setting up Nginx [skipped]
Nginx setup task was skipped, skipping SSL setup
ℹ Setting up SSL [skipped]
? Do you want to start Ghost? Yes
✖ Starting Ghost
One or more errors occurred.
1) SystemError
Message: The content folder is not owned by the current user.
Ensure the content folder has correct permissions and try again.
Debug Information:
OS: CentOS Stream, v8
Node Version: v16.17.1
Ghost Version: 5.19.0
Ghost-CLI Version: 1.23.0
Environment: development
Command: 'ghost install --no-stack'
Try running ghost doctor to check your system for known issues.
You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.
ghost doctor executes as follows:
[kevin@cube_hk_1 ghost]$ ghost doctor
Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js
Running in development mode
┌────────────────────────────────────────────────── ────────────────────────────────────┐
│Warning: MySQL 8 will be the required database in the next major release of Ghost.│
│ Make sure your database is up to date to ensure forwards compatibility. │
└────────────────────────────────────────────────── ──────────────────────────────────────┘
✔ Checking system Node.js version - found v16.17.1
ℹ Ensuring user is not logged in as ghost user [skipped]
ℹ Checking if logged in user is directory owner [skipped]
✔ Checking current folder permissions
✔ Checking for a MySQL installation
✔ Validating config
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking free space
other instructions:
Ghost directory permissions:
[kevin@cube_hk_1 ghost]$ ll -al
Total usage 24
drwxrwxr-x. 4 kevin kevin 4096 Oct 16 19:41 .
drwxr-xr-x.4 root root 4096 Sep 25 04:26 ..
-rw-rw-r--. 1 kevin kevin 493 Oct 16 19:41 config.development.json
drwxrwxr-x. 11 ghost ghost 4096 Oct 16 19:37 content
lrwxrwxrwx. 1 kevin kevin 30 Oct 16 19:38 current -> /var/www/ghost/versions/5.19.0
-rw-rw-r--. 1 kevin kevin 109 Oct 16 19:41 .ghost-cli
drwxrwxr-x. 3 kevin kevin 4096 Oct 16 19:37 versions
User permissions:
[kevin@cube_hk_1 ghost]$ groups kevin
kevin : kevin
[kevin@cube_hk_1 ghost]$ groups ghost
ghost : ghost
Granted sudo and directory permissions to kevin:
[kevin@cube_hk_1 ghost]$ sudo chown kevin:kevin /var/www/ghost
[kevin@cube_hk_1 ghost]$ sudo chmod 775 /var/www/ghost