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

featherpad can only handle one user at a time on OpenBSD #264

Closed
bdantas opened this issue Apr 4, 2019 · 7 comments

Comments

Projects
None yet
2 participants
@bdantas
Copy link

commented Apr 4, 2019

I compiled -master branch (version 0.10.0) on OpenBSD 6.4.

If I open a file as root then, while that file is still open, open a different file as bruno (my non-root user), the bruno instance says "a previous crash detected!"

Conversly, if bruno user opens a file first then root opens a privileged system file, root can't save changes because the root instance isn't running as root.

During hacking session I need the editor to run as root when launched by root and run as bruno when launched by bruno, with multiple files open by both users.

@tsujan

This comment has been minimized.

Copy link
Owner

commented Apr 4, 2019

Thanks for the report! I'll investigate it and might need to ask you questions about OpenBSD (*BSD).

@tsujan

This comment has been minimized.

Copy link
Owner

commented Apr 4, 2019

@bdantas

I think this is about neither *BSD nor FeatherPad but caused by wrong root environment variables.

(1) Which command do you use to open FeatherPad as root?

(2) What's the output of echo $USER as root inside a terminal that you open with the same command that you used to open FeatherPad as root?

I think the privilege program you use doesn't set the correct EVs as root. The output in (2) should be "root" but it's your user name; isn't it?

If so, that would be dangerous because it could change the permissions of your config files, so that you couldn't configure apps as user after you open them as root.

@bdantas

This comment has been minimized.

Copy link
Author

commented Apr 4, 2019

(1)
In qterminal running as root: # featherpad /etc/somefile
In qterminal running as non-root user (bruno): $ doas featherpad /etc/somefile

(2) In all cases, output of echo $USER is bruno

it could change the permissions of your config files, so that you couldn't configure apps as user after you open them as root.

Indeed, for a long time I've had this issue.

So you are right. I don't think this is an OpenBSD bug or a featherpad bug, but a problem with my environment. I suspect the problem is with pcmanfm-qt and/or qterminal and/or LXQt because this issue does not occur in OpenBSD+MATE.

Any idea how to solve this, so that qterminal and pcmanfm-qt change value of USER to root when appropriate?

@bdantas

This comment has been minimized.

Copy link
Author

commented Apr 4, 2019

I figured it out. Just needed to change /etc/doas.conf from this:

permit nopass keepenv bruno

to this:

permit nopass keepenv setenv { USER=root HOME=/root DISPLAY=:0.0 XAUTHORITY=/home/bruno/.Xauthority } bruno

tsujan, that was some extremely impressive deductive work on your part.

@tsujan

This comment has been minimized.

Copy link
Owner

commented Apr 4, 2019

I don't think this is an OpenBSD bug or a featherpad bug

Definitely!

Any idea how to solve this, so that qterminal and pcmanfm-qt change value of USER to root when appropriate?

If you use LXQt, upgrade to its latest release (0.14.X). lxqt-sudo had this problem but it was fixed at last, after a long discussion between another dev and me -- we had our differences about how to set the root EVs. I guess you have an old (buggy) version of lxqt-sudo.

If you can't upgrade LXQt for now, use the MATE privilege program inside it (gksu? gksu should be safe everywhere, as far as I know).

And never use the mere sudo with GUI apps! It could also change user permissions for the same reason.

Anyhow, it seems that FeatherPad's warning-bar revealed the problem here :)

@tsujan

This comment has been minimized.

Copy link
Owner

commented Apr 4, 2019

tsujan, that was some extremely impressive deductive work on your part.

That was because of your clean report :)

@tsujan tsujan closed this Apr 4, 2019

@tsujan

This comment has been minimized.

Copy link
Owner

commented Apr 4, 2019

I figured it out. Just needed to change /etc/doas.conf from this:
permit nopass keepenv bruno
to this:
permit nopass keepenv setenv { USER=root } bruno

For the sake of completeness, I should add that USER=root is necessary but, perhaps, not sufficient. The root EVs should be chosen with care; a good privilege program does that for you.

The above-mentioned discussion between that LXQt dev and me was about how careful we should be; IMO, he was too careful ;) Anyway, the final result was OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.