I'm trying to run ADB on a linux server with multiple users where I am not root (to play with my android emulator). The adb daemon writes its logs to the file /tmp/adb.log
which unfortunately seems to be hard-coded into ADB and this situation is not going to change.
So, adb is failing to run, giving the obvious error: cannot open '/tmp/adb.log': Permission denied
. This file is created by another user and /tmp
has sticky bit on. If I start adb with adb nodaemon server
making it write to stdout, no errors occur (I also set up its port to a unique value to avoid conflicts).
My question is: is there some way to make ADB write to another file than /tmp/adb.log
? More generally, is there a way to create a sort of a process-specific symlink? I want to redirect all file accesses to /tmp/adb.log
to, saying, a file ~/tmp/adb.log
.
Again, I am not root on the server, so chroot
, mount -o rbind
and chmod
are not valid options. If possible, I'd like not to modify ADB sources, but surely if there are no other solutions, I'll do that.
P.S. For the specific ADB case I can resort to running adb nodaemon server
with nohup
and output redirection, but the general question is still relevant.
/tmp/adb.log
, or even mount its own private/tmp
altogether. doman unshare
andman namespaces
andman nsenter
. – mikeserv Oct 21 '15 at 13:59LD_PRELOAD
tricks, though that would be more complicated. – thrig Oct 21 '15 at 14:47/home/$USER/tmp/adb.log
and rebuild adb :) – gluk47 Oct 21 '15 at 14:49