Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is sudo used in the uninstall command? #577

Closed
travismiller opened this issue Jan 5, 2018 · 4 comments · Fixed by #634
Closed

Why is sudo used in the uninstall command? #577

travismiller opened this issue Jan 5, 2018 · 4 comments · Fixed by #634

Comments

@travismiller
Copy link

This makes it not possible to automate uninstall if the user does not have or need sudo.

If it is necessary, should there be a option to not use sudo? ghost uninstall --no-sudo

if (os.platform() === 'linux') {
return this.ui.sudo(`rm -rf ${contentDir}`);
}

@acburdine
Copy link
Member

The reason sudo is used is because, by default in production, an additional ghost user is created to run the Ghost server process. That user is then made owner of the content folder. Hence during uninstall, sudo is required to remove that content folder.

I can update that check there to also check if the content folder is actually owned by the ghost user, but if it is owned by the ghost user there's no way to run uninstall completely without sudo.

What, specifically, is your use case for automating uninstalls?

@acburdine
Copy link
Member

@travismiller ^

@travismiller
Copy link
Author

@acburdine thanks for the clarification!

Using sudo in the default case (production) makes sense to me. Though, I do prefer your idea of detecting the ownership of the directory as a condition of using sudo.

Our use case is not well defined, but we're experimenting with a developer kit for developing multiple Ghost projects. Our developers would all be darwin and would not encounter this anyway.

FWIW, here's some throw away code I wrote while exploring the issue that compares ownership. broco1974@06fe197

@acburdine
Copy link
Member

Makes sense.

@kirrg001 kirrg001 added the later label Jan 13, 2018
@acburdine acburdine self-assigned this Feb 7, 2018
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Feb 7, 2018
closes TryGhost#577
- cleanup uninstall tests
- disable remove content folder step if ghost user doesn't own content folder
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Feb 7, 2018
closes TryGhost#577
- cleanup uninstall tests
- disable remove content folder step if ghost user doesn't own content folder
aileen pushed a commit that referenced this issue Feb 7, 2018
closes #577
- cleanup uninstall tests
- disable remove content folder step if ghost user doesn't own content folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants