Ghost-CLI: Ghost-CLI don't create "ghost" system user, ghost install via the CLI failed
This issue is a
- Bug Report
- Feature Request
Summary
According to the documentation it’s indicated:
Create a New User
When you first log into your new server it is highly recommended to create a new user with regular account privileges and do some basic system setup.
Please don’t call this user ghost, Ghost-CLI will create the ghost user for managing your blog. The user you are creating is for administrating your server
So i create a user named “ghostuser” (different than ‘ghost’) and I followed the installation procedure (there was another bug identified and while waiting for it to be fixed there is a way to bypass).
When arrive time to install ghost, i try to install via the CLI, that’s failed at the end with this error message:
✖ Setting up "ghost" system user
An error occurred.
Message: 'Command failed: /bin/sh -c id ghost
id: « ghost » : user unknown
Steps to Reproduce (for a bug report)
- Create a New User and Super User Privileges
adduser ghostuser
cat /etc/passwd
ghostuser:x:1002:1002:Ghost User,,,:/home/ghostuser:/bin/bash
usermod -aG sudo ghostuser
-
Installation NodeJS v8.10.0 and NPM
-
Check NodeJS and NPM versions
-
Installation Ghost-CLI v1.5.2 (for now the lasted)
-
Install Ghost via the CLI
sudo mkdir -p /var/www/ghost
sudo chown ghostuser:ghostuser /var/www/ghost
sudo chmod 775 /var/www/ghost
cd /var/www/ghost
ghostuser@host:/var/www/ghost$ ghost install
✔ Checking system Node.js version
✔ Checking current folder permissions
System checks failed with message: 'Linux version is not Ubuntu 16'
Some features of Ghost-CLI may not work without additional configuration.
For local installs we recommend using `ghost install local` instead.
? Continue anyway? Yes
ℹ Checking operating system compatibility [skipped]
✔ Checking for a MySQL installation
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v1.21.5
✔ Finishing install process
? Enter your blog URL: http://localhost:2368
? Enter your MySQL hostname: localhost
? Enter your MySQL username: ghostadmin
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: ghost_prod
✔ Configuring Ghost
✔ Setting up instance
✖ Setting up "ghost" system user
An error occurred.
Message: 'Command failed: /bin/sh -c id ghost
id: « ghost » : user unknown
'
I think it’s a bug because same error with sudo ghost setup linux-user:
ghostuser@host:/var/www/ghost$ ghost setup linux-user
✖ Setting up "ghost" system user
An error occurred.
Message: 'Command failed: /bin/sh -c id ghost
id: « ghost » : user unknown
'
Debug Information:
OS: Debian, v9.4
Node Version: v8.10.0
Ghost-CLI Version: 1.5.2
Environment: production
Command: 'ghost setup linux-user'
Technical details (for a bug report)
This is automatically output by Ghost-CLI if an error occurs, please copy & paste:
Debug Information:
OS: Debian, v9.4
Node Version: v8.10.0
Ghost-CLI Version: 1.5.2
Environment: production
Command: 'ghost install'
An error occurred.
Message: 'Command failed: /bin/sh -c id ghost
id: « ghost » : user unknown
'
Stack: Error: Command failed: /bin/sh -c id ghost
id: « ghost » : user unknown
at makeError (/usr/lib/node_modules/ghost-cli/node_modules/execa/index.js:169:9)
at module.exports.sync (/usr/lib/node_modules/ghost-cli/node_modules/execa/index.js:338:15)
at handleShell (/usr/lib/node_modules/ghost-cli/node_modules/execa/index.js:116:9)
at Function.module.exports.shellSync (/usr/lib/node_modules/ghost-cli/node_modules/execa/index.js:361:43)
at SetupCommand.linuxSetupTask (/usr/lib/node_modules/ghost-cli/lib/tasks/linux.js:10:15)
at Promise.resolve.then.then.skipped (/usr/lib/node_modules/ghost-cli/node_modules/listr/lib/task.js:168:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
Code: 1
If I was creating the system user ‘ghost’ before starting the installation of ghost via the cli then it’s ok, installation done:
root@host:~# useradd ghost
root@host:~# passwd ghost
root@host:/# su - ghostuser
ghostuser@host:~$ cd /var/www/ghost/
ghostuser@host:/var/www/ghost$ ghost install
✔ Checking system Node.js version
✔ Checking current folder permissions
System checks failed with message: 'Linux version is not Ubuntu 16'
Some features of Ghost-CLI may not work without additional configuration.
For local installs we recommend using `ghost install local` instead.
? Continue anyway? Yes
ℹ Checking operating system compatibility [skipped]
✔ Checking for a MySQL installation
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v1.21.5
✔ Finishing install process
? Enter your blog URL: http://localhost:2368
? Enter your MySQL hostname: localhost
? Enter your MySQL username: ghostadmin
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: ghost_prod
✔ Configuring Ghost
✔ Setting up instance
Running sudo command: chown -R ghost:ghost /var/www/ghost/content
? Password [hidden]
✔ Setting up "ghost" system user
? Do you wish to set up "ghost" mysql user? Yes
MySQL user is not "root", skipping additional user setup
ℹ Setting up "ghost" mysql user [skipped]
? Do you wish to set up Nginx? Yes
Your url contains a port. Skipping Nginx setup.
ℹ Setting up Nginx [skipped]
Task ssl depends on the 'nginx' stage, which was skipped.
ℹ Setting up SSL [skipped]
? Do you wish to set up Systemd? Yes
✔ Creating systemd service file at /var/www/ghost/system/files/ghost_localhost.service
Running sudo command: ln -sf /var/www/ghost/system/files/ghost_localhost.service /lib/systemd/system/ghost_localhost.service
Running sudo command: systemctl daemon-reload
✔ Setting up Systemd
Running sudo command: /var/www/ghost/current/node_modules/.bin/knex-migrator-migrate --init --mgpath /var/www/ghost/current
✔ Running database migrations
? Do you want to start Ghost? Yes
✔ Checking current folder permissions
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
Running sudo command: systemctl start ghost_localhost
✔ Starting Ghost
Running sudo command: systemctl enable ghost_localhost --quiet
✔ Starting Ghost
You can access your blog at http://localhost:2368/
maybe I misunderstood the documentation. I think I should be don’t create a system user named ‘ghost’ because Ghost-CLI will create the ghost user for managing your blog.
If this is the case then there is a bug because Ghost-CLI does not create the ghost user.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 15 (5 by maintainers)
Commits related to this issue
- fix(linux): remove strict no such user error message checking closes #676 - an error thrown in this place essentially means there's no user, so the strict error message checking is unnecessary and br... — committed to acburdine/Ghost-CLI by acburdine 6 years ago
- fix(linux): remove strict no such user error message checking closes #676 - an error thrown in this place essentially means there's no user, so the strict error message checking is unnecessary and br... — committed to TryGhost/Ghost-CLI by acburdine 6 years ago
@gh0-0st Apologies, I was mistaken before. We did add something that fixed an issue similar to the one you’re running into, but the fix was in a different part of the codebase.
The TL;DR of the issue is that Ghost-CLI tries to create the
ghostuser, and checks the response from theid -u ghostcommand to see if the user already exists. We check the error message and if it matches the known error message for ‘no such user’ we go ahead and create the user. However, because we’re checking the error message strictly, ifidoutputs the same meaning but in a different format (or in your case, language) than it doesn’t match and therefore fails. The fix we added in earlier was to remove the strict error message checking - it just didn’t get applied to this part of the code.I’ll work on that fix asap since I know where it is now 😃
@acburdine well done, thank you for your fix.
In Debian 9.4 (Stretch) with Ghost-CLI v1.8.0, the ghost install ok for now (ghost system user is successfully created):
… ✔ Configuring Ghost
✔ Setting up instance Running sudo command: useradd --system --user-group ghost Running sudo command: chown -R ghost:ghost /var/www/ghost/content
✔ Setting up “ghost” system user
@vikaspotluri123 thank you so much for your information, it’s most understand. Ok so i wait for the next version.
Nevermind, I just read the error log. While this is technically an unsupported OS, a fix should go out later this week for this.