New install of latest Ghost fails due to permissions

New install of latest Ghost fails due to permissions of content folder. Unable to start a fresh install

  • What’s your URL? http://<mydomain>.co.uk
  • What version of Ghost are you using? Ghost v3.38.2 and Ghost-CLI v1.15.2

And

  • How was Ghost installed and configured?
    Vanilla instance of Ubuntu Focal Fossa on Scaleway public cloud
    instance details:
  • 2x x86_64 cores
  • 2gb memory
  • 20gb ssd
  • What Node version, database, OS & browser are you using?
    Node: v12.19.1
    MySQL: 8.0.22-0ubuntu0.20.04.2
    OS: Ubuntu Ubuntu 20.04.1 LTS

  • What errors or information do you see in the console?

✔ Checking system Node.js version
✔ Checking logged in user
✔ Checking current folder permissions
✔ Checking system compatibility
✔ Checking for a MySQL installation
✔ Checking memory availability
✔ Checking free space
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v3.38.2
✔ Finishing install process
? Enter your blog URL: http://<mydomain>.co.uk
? Enter your MySQL hostname: localhost
? Enter your MySQL username: root
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: ghost_prod
✔ Configuring Ghost
✔ Setting up instance
+ sudo useradd --system --user-group ghost
+ 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
? Do you wish to set up Nginx? Yes
+ sudo mv /tmp/<mydomain>-co-uk/<mydomain>.co.uk.conf /etc/nginx/sites-available/<mydomain>.co.uk.conf
+ sudo ln -sf /etc/nginx/sites-available/<mydomain>.co.uk.conf /etc/nginx/sites-enabled/<mydomain>.co.uk.conf
+ sudo nginx -s reload
✔ Setting up Nginx
? Do you wish to set up SSL? No
ℹ Setting up SSL [skipped]
? Do you wish to set up Systemd? No
Systemd setup skipped, reverting to local process manager
ℹ Setting up Systemd [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: Ubuntu, v20.04.1 LTS
    Node Version: v12.19.1
    Ghost Version: 3.38.2
    Ghost-CLI Version: 1.15.2
    Environment: production
    Command: 'ghost install'

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

You can always refer to https://ghost.org/docs/api/ghost-cli/ for troubleshooting.

File permissions

omranb@ghost:/var/www/ghost$ ls -al
total 24
drwxrwxr-x 4 omranb omranb 4096 Nov 22 12:33 .
drwxr-xr-x 4 root   root   4096 Nov 22 12:30 ..
-rw-rw-r-- 1 omranb omranb   88 Nov 22 12:33 .ghost-cli
-rw-rw-r-- 1 omranb omranb  497 Nov 22 12:33 config.production.json
drwxrwxr-x 8 ghost  ghost  4096 Nov 22 12:30 content
lrwxrwxrwx 1 omranb omranb   30 Nov 22 12:33 current -> /var/www/ghost/versions/3.38.2
drwxrwxr-x 3 omranb omranb 4096 Nov 22 12:30 versions

I attempted to change the owner of the content folder using
sudo chown -R omranb:omranb /var/www/ghost/content

The error persists and the folder permissions are reverted to ghost when running ghost setup

  • What steps could someone else take to reproduce the issue you’re having?
    output from hist
as root:
root@ghost:~# history
    1  adduser omranb
    2  usermod -aG sudo omranb
    3  su - omranb
    4  history

as omranb:
root@ghost:~# su - omranb
omranb@ghost:~$ history
    1  sudo apt-get update
    2  sudo apt-get upgrade
    3  sudo apt-get install nginx
    4  sudo apt-get install mysql-server
    5  sudo mysql
    6  curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash
    7  sudo apt-get install -y nodejs
    8  sudo npm install ghost-cli@latest -g
    9  sudo mkdir -p /var/www/ghost
   10  sudo chown omranb:omranb /var/www/ghost
   11  sudo chmod 775 /var/www/ghost
   12  cd /var/www/ghost
   13  ghost install
   14  mysql -u root -p -v
   15  cat /etc/issue
   16  ls -al
   17  exit
   18  history

Can you try running ghost doctor and running any suggested commands?

This is the output for ghost doctor, there are no suggested commands

omranb@ghost:/var/www/ghost$ ghost doctor
✔ Checking system Node.js version
ℹ 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

Aah, I think you’re running into this issue because you’re using the local process manager. Is there a reason you chose not to set up systemd?

Thanks, that fixed the problem.

There wasn’t any particular reason I didn’t use systemd. Now that I’ve selected ‘Y’, it works.

Thank you for your help.

1 Like