CLI Problem running on Ubuntu in Termux
Hi,
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:
root@localhost:~# 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. root@localhost:~# id uid=0(root) gid=0(root) groups=0(root),3003(aid_inet),9997(aid_everybody),20597(aid_),50597(aid_) root@localhost:~# 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/ root@localhost:~#
Any help would be appreciated.
Regards, Thomas
Comments
-
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.0 -
It would be interessting to know what op actually checks when this error is reported.
0 -
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?
0 -
I think "safely" is the key here.
0 -
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.
0 -
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:
root@localhost:~# 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.
0 -
Who owns the root home dir? You may be logged in as root but the folder might belong to someone else.
0 -
root@localhost:~# ll $HOME total 135 drwx------. 18 root root 3452 Feb 22 12:19 ./
0 -
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.0 -
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.
0