ProtonMail / proton-bridge

Proton Mail Bridge application
GNU General Public License v3.0
1.11k stars 145 forks source link

Cannot run as normal user #458

Closed dbergloev closed 6 months ago

dbergloev commented 6 months ago

Hi.

So I tried setting up this bridge in a headless fasion where I wanted to have it run under a regular controlled user rather than root, but this does not seam possible.

su bridge
/protonmail/proton-bridge --cli 

Which produces the following error:

FATA[Jan 18 18:31:26.667] could not create bridge: failed to create bridge: mkdir /root/.local: permission denied 
FATA[Jan 18 18:31:26.669] Failed to launch                              error="exit status 1" exe_path=/protonmail/bridge exe_to_launch=bridge launcher_path=/protonmail/proton-bridge launcher_version=3.8.1+git

The issue seams to be mkdir /root/.local: permission denied which is strange, because $HOME = /config.

LBeernaertProton commented 6 months ago

Hey @dbergloev , did you assign a home directory for this custom user?

dbergloev commented 6 months ago

Yes I did

adduser --system --shell /bin/bash --home /config bridge
su bridge
echo $HOME
/config
LBeernaertProton commented 6 months ago

Can you try setting XDG_DATA_HOME for the bridge user?

dbergloev commented 6 months ago

That seams to do the trick

dbergloev commented 6 months ago

So protonmail bridge is actually using the XGD variables, that's actually awsome. Not really used to apps doing that, but all should. Well, I will just set this manually, since it's not set on login on my setup.

LBeernaertProton commented 6 months ago

We first check XDG_DATA_HOME before checking HOME.

Closing as resolved.

dbergloev commented 6 months ago

We first check XDG_DATA_HOME before checking HOME.

Closing as resolved.

Well in my case $HOME is set and $XDG_DATA_HOME was not, so if that is true, then something is up with that first check.

LBeernaertProton commented 6 months ago

There must be some value assigned to XDG_DATA_HOME, otherwise we would not have used that value.