samjulien
By:
samjulien

Should I add a user for working on my Ghost one-click install?

March 30, 2017 341 views
Ghost One-Click Install Apps Linux Commands Ubuntu 16.04

I've been spinning up the Ghost one-click on Ubuntu 16.04 and really digging it. By default, DO creates a ghost user that owns the folder and the systemd service. I need to make some edits to the templates and CSS. What's the most secure way to set this up? Should I:

  • Do it as root? (I'm guessing no.)
  • Get access to the ghost user somehow? DO doesn't give you the password for the ghost user when it creates the droplet.
  • Set up a separate developer user? If so, what permissions? (Apologies, still fairly new to this world.)

Thanks!

1 Answer

@samjulien

The ghost user most likely isn't setup with a password, which is probably intentional as the one-click doesn't setup SFTP for use with multiple user accounts, nor sets ghost as a sudo user.

You can make changes as root -- it won't change permissions on an existing file. If you create a new file from the CLI as root, however, you'd need to make sure it's owned by the same user and group as the other files.

So if you run ls -al and see ghost and ghost, that's the user and group, so any new files you create from the CLI would need to modified using chown (change ownership).

For example, if we create a new file demo.txt as root and we want that file to be owned by ghost, we'd run:

chown ghost:ghost demo.txt

The above works on directories as well. If we had a directory /var/www/html/mynewdir and we wanted it to be owned by ghost:

chown ghost:ghost /var/www/html/mynewdir

We can also do recursion, which means all files and directories in a given path will be changed to the user and group specified. You need to be careful with this one. Make sure the path you specify is correct as there is no undo button.

chown -R ghost:ghost /var/www/html/mynewdir

The above changes ownership on mynewdir and all files and directories under it.

chown -R ghost:ghost /var/www/html/mynewdir/*

The above changes ownership of all files and directories under mynewdir but not mynewdir.

Have another answer? Share your knowledge.