I am trying to use op in Ubuntu that is run via proot (https://github.com/termux/proot-distro) in Termux on Android.
This is what I see:
[email protected]:~# op signin [ERROR] 2021/02/24 08:28:05 Can't continue. We can't safely access "/root/.config/op" because it's not owned by the current user. Change the owner or logged in user and try again. [email protected]:~# id uid=0(root) gid=0(root) groups=0(root),3003(aid_inet),9997(aid_everybody),20597(aid_),50597(aid_) [email protected]:~# ll "/root/.config/" total 18 drwx------. 5 root root 3452 Feb 3 09:44 ./ drwx------. 18 root root 3452 Feb 22 12:19 ../ drwxr-xr-x. 2 root root 3452 Feb 3 08:06 code-server/ drwx------. 2 root root 3452 Jan 31 10:47 op/ drwx------. 2 root root 3452 Feb 3 09:44 procps/ [email protected]:~#
Any help would be appreciated.
Hey @thofmann ,
We don't really know Termux or Proot, so I'm not sure how much we can help you there, but from a quick online search I found some vague information about it being an emulator of a terminal environment and even though it looks like you have root access, it still restricts who can access the actual device's root files (or something of that sort).
You can also try to move the config file, as described in the latest version's release notes: https://app-updates.agilebits.com/product_history/CLI#v1080001
Sorry I don't have a better answer, but I hope this bit of information will point you in the right direction.
It would be interessting to know what op actually checks when this error is reported.
Hey @thofmann ,
op is trying to access its config file so it can save your account's info (email, domain, session etc). Without it op won't work :)
Sure but it does some checks and decides that "We can't safely access "/root/.config/op". What does that mean? What checks are being done here?
I think "safely" is the key here.
Hey @thofmann ,
The Secret Key of your account is stored in plain text, which is why we want to only store it (safely) in your current user account that you are logged into. The permissions you show in the log is that you have root access but you are not the root user. It would be best to store the config file in your own user's root folder and not in the actual root user. Alternatively if you can actually log into the system as root then you should be able to make it work.
Thanks for your explanation and I understand that this is crucial if the secretKey is stored there.
Isn't it the case that I should be recognized as the root user:
[email protected]:~# id uid=0(root) gid=0(root) groups=0(root),3003(aid_inet),9997(aid_everybody),20597(aid_),50597(aid_)
I don't see why op should think something else.
Who owns the root home dir? You may be logged in as root but the folder might belong to someone else.
[email protected]:~# ll $HOME total 135 drwx------. 18 root root 3452 Feb 22 12:19 ./
My guess is that op has some clever way to determine the owner. And that might lead to different results then what I see in the shell.
All of this due to running under proot. That is why it would be interessting to know how this check is actually done in code.
There’s nothing too clever about how we determine the ownership and permissions there unfortunately :)
op Takes the current user’s UID using os/user.current() and compares that with the file info UID of the config file.
We don’t really know proot or understand what changes it makes to the root file system, but since everything else checks out, we believe that will be the direction in which you need to investigate.