# Workaround for needing sudo access for webserver user

**URL:** <https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262>\
**Category:** Migrations\
**Created:** [November 15, 2020, 2:57am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262 "2020-11-15T02:57:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![unixandria](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unixandria](https://forum.ghost.org/u/unixandria)\
**Post date:** [November 15, 2020, 2:57am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/1 "2020-11-15T02:57:51Z")

</div>

Who in this godly world thought it’s a good idea to force you to make your webserver user have to be sudo?

My setup is an Ubuntu 20.04 bare metal server. The server software I use is Caddy v2 running under www-data

I’m looking at alternatives to WordPress and found ghost.

However during install, it’s demanding my sudo password. Huge problem as the webserver user has no password and doesn’t have and never will be given sudo access (security nightmare!).

Can I manually run the commands under my normal user account that does have sudo access? If so, what do I need to run.

---

<div class="post-metadata">

**Author:** ![unixandria](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unixandria](https://forum.ghost.org/u/unixandria)\
**Post date:** [November 15, 2020, 3:00am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/2 "2020-11-15T03:00:21Z")

</div>

Do note just give it sudo access is not an option, I have never and will never give an Internet facing application that’s not behind 4096 bit RSA key authentication (and that’s only for SSH!) privileged access

---

<div class="post-metadata">

**Author:** ![unixandria](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unixandria](https://forum.ghost.org/u/unixandria)\
**Post date:** [November 15, 2020, 3:09am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/3 "2020-11-15T03:09:45Z")

</div>

Ffs it’s not even letting me run it as root, so you’re literally forcing me into a security nightmare.

Yeah let my internet accessible application have unlimited privilege great idea!

---

<div class="post-metadata">

**Author:** ![unixandria](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unixandria](https://forum.ghost.org/u/unixandria)\
**Post date:** [November 15, 2020, 3:15am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/4 "2020-11-15T03:15:55Z")

</div>

Also how do I work around it wanting to run as ghost user? I have multiple sites behind Caddy and all of their files are owned by www-data with 700 permission

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [November 15, 2020, 3:32am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/5 "2020-11-15T03:32:23Z")

</div>

> [@unixandria](#):
>
> However during install, it’s demanding my sudo password. Huge problem as the webserver user has no password and doesn’t have and never will be given sudo access (security nightmare!).

The Ghost CLI is used to help automate installation and management of Ghost instances for self-hosters. Part of the process for full installation requires configuring a process manager (systemd) which may require root permissions. Configuring nginx (the default web server) also requires root permissions.

If you don’t want the CLI to do any of this, you can tell it not to. It’s more than possible to use the CLI for installing and updating Ghost without any other integration with the system. Of course, you’ll have to configure some stuff yourself.

Before posting again, please take a moment to review the [Ghost Code of Conduct](https://ghost.org/conduct/). I understand that you’re frustrated, but making incorrect assumptions and inflammatory statements are not acceptable.

To be clear, the system user that runs ghost will never need sudo access. The user that installs Ghost might need sudo access.

---

<div class="post-metadata">

**Author:** ![unixandria](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unixandria](https://forum.ghost.org/u/unixandria)\
**Post date:** [November 15, 2020, 3:41am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/6 "2020-11-15T03:41:58Z")

</div>

And of course, the install docs mention absolutely nothing about any other install methods than the default one.  
I really don’t care about system integration:

1. I’m not using NGINX
2. Caddy has built in SSL certificate management (reason #1 I use it 😛)
3. I’m more than capable of writing my own systemd services (caddy is using one since I built it myself)

And of course I’m going to run the install as the user it is going to be running as, otherwise it’s going to not going to have access. This is a multi user server and multi service server; permissions are very restrictive by design (sudo group doesn’t have sudo access even - that’s limited to my user only).

At any rate, you told me there is a way around it and didn’t mention how.

Once again: how should I work around needing sudo access to install?

---

<div class="post-metadata">

**Author:** ![unixandria](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unixandria](https://forum.ghost.org/u/unixandria)\
**Post date:** [November 15, 2020, 3:44am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/7 "2020-11-15T03:44:01Z")

</div>

I did end up trying a local install with caddy doing a reverse proxy but then my browser said localhost: connection refused on the main page, so I figured it probably needs that URL set correctly to function (even though this is running on my non-production site, I’m still accessing it remotely)

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [November 15, 2020, 4:03am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/8 "2020-11-15T04:03:34Z")

</div>

_Again, please take a moment to read the CoC linked in my previous thread._

You’re right that I didn’t tell you how, and that’s because I forgot that the CLI handles the issue you mentioned

> [@unixandria](#):
>
> And of course I’m going to run the install as the user it is going to be running as, otherwise it’s going to not going to have access

by running `sudo chown -R ghost:ghost /path/to/install/content` because that’s the only folder the system user needs access to (everything else needs to be read-only). I was expecting that saying no to systemd and nginx would be enough to have the CLI not ask for sudo access

You can bypass all sudo requirements by adding the `--no-setup-linux-user` flag to the installation and saying no to systemd and nginx. (e.g. `ghost install --no-setup-linux-user`)

Just so you understand, the CLI has a happy path that works for most users. It’s possible to use the CLI outside of the happy path, but there’s a lot less documentation and hand-holding because functionality is a “best-effort” guarantee.

---

<div class="post-metadata">

**Author:** ![unixandria](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unixandria](https://forum.ghost.org/u/unixandria)\
**Post date:** [November 15, 2020, 4:12am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/9 "2020-11-15T04:12:21Z")

</div>

Systemd step doesn’t seem to let me skip it

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [November 15, 2020, 4:13am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/10 "2020-11-15T04:13:04Z")

</div>

Can you post a screen shot with what you’re seeing? It’s hard to debug w/o context 😉

---

<div class="post-metadata">

**Author:** ![unixandria](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unixandria](https://forum.ghost.org/u/unixandria)\
**Post date:** [November 15, 2020, 4:21am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/11 "2020-11-15T04:21:54Z")

</div>

Hmm, seems it complaining about systemd is a non-issue just an incorrect error message - it’s loading fine now 🙂

It however doesn’t prompt me to skip systemd setup but says it’s already setup, but then informs me it’s corrupt

---

<div class="post-metadata">

**Author:** ![unixandria](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unixandria](https://forum.ghost.org/u/unixandria)\
**Post date:** [November 15, 2020, 4:24am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/12 "2020-11-15T04:24:41Z")

</div>

Actually it’s not oof, browser caching

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [November 15, 2020, 4:25am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/13 "2020-11-15T04:25:12Z")

</div>

Can you run `ghost ls` to see if your ghost instance is running? If it’s not, maybe try running through the setup by disable all the things by default (`ghost setup --no-setup-linux-user --no-setup-nginx --no-setup-systemd`)

---

<div class="post-metadata">

**Author:** ![unixandria](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unixandria](https://forum.ghost.org/u/unixandria)\
**Post date:** [November 15, 2020, 4:29am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/14 "2020-11-15T04:29:38Z")

</div>

![Screenshot_20201114-232908](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/9/9d2f460baeee35a2a8115fdefa00a056915549c7.jpeg)

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [November 15, 2020, 4:32am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/15 "2020-11-15T04:32:27Z")

</div>

Ooh, I thought you were saying `systemd` setup failed…

You’re going to have to set up systemd independent of Ghost, and use it to start / stop Ghost

… which also means `ghost ls` will probably be useless for determining what ghost instances are running

---

<div class="post-metadata">

**Author:** ![Roger\_Champagne](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/roger_champagne/32/1499_2.png) [@Roger\_Champagne](https://forum.ghost.org/u/Roger_Champagne)\
**Post date:** [November 16, 2020, 3:41pm UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/16 "2020-11-16T15:41:41Z")

</div>

Perhaps this could help you setting up **systemd** for your Ghost instance:

```
[Unit]
Description=Ghost systemd service for blog: yourblogname.net
Documentation=https://docs.ghost.org

[Service]
Type=simple
WorkingDirectory=/var/www/yourblogdirectory
User=1003
Environment="NODE_ENV=production"
ExecStart=/usr/bin/nodejs /usr/bin/ghost run
Restart=always

[Install]
WantedBy=multi-user.target
```

---

<div class="post-metadata">

**Author:** ![unixandria](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unixandria](https://forum.ghost.org/u/unixandria)\
**Post date:** [November 16, 2020, 4:38pm UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/17 "2020-11-16T16:38:13Z")

</div>

I’ve got it running just one issue I have left:

Can I make / point to /home? Thing is I have a custom homepage that can’t be easily handled with the home.hbs trick outlined in the docs

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [November 16, 2020, 5:34pm UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/18 "2020-11-16T17:34:05Z")

</div>

Have you seen this tutorial? If you’re having issues, can you share the routes file you’re using?

> **[How to build a custom homepage for your Ghost theme](https://ghost.org/tutorials/custom-homepage/)**
>
> A gorgeous hero section, engaging calls to action, stunning photography — learn how to build a custom homepage for your Ghost theme in this tutorial.

---

<div class="post-metadata">

**Author:** ![unixandria](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unixandria](https://forum.ghost.org/u/unixandria)\
**Post date:** [November 24, 2020, 3:53am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/19 "2020-11-24T03:53:10Z")

</div>

That’s exactly what I don’t want to do. I don’t have the inclination nor know how to translate my existing rather complicated home page to an hbs file

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [November 24, 2020, 3:54am UTC](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262/20 "2020-11-24T03:54:24Z")

</div>

Renaming `home.html` to `home.hbs` should be enough

[Next page](https://forum.ghost.org/t/workaround-for-needing-sudo-access-for-webserver-user/18262.md?page=2)
