nelhage / reptyr

Reparent a running program to a new terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Works in any Linux terminal?

trusktr opened this issue · comments

Or does it have to be used in screen?

I get this when trying:

>>> reptyr 8274
Unable to attach to pid 8274: Operation not permitted
The kernel denied permission while attaching. If your uid matches
the target's, check the value of /proc/sys/kernel/yama/ptrace_scope.
For more information, see /etc/sysctl.d/10-ptrace.conf

>>> sudo reptyr 8274
[sudo] password for root:
[-] Unable to open the tty in the child.
Unable to attach to pid 8274: Permission denied

Hm, I think that it won't work currently if run on a non-root process as root, although I might be able to fix that.

Does sudo reptyr -T $pid work? That will engage a different mode of attaching, which is designed to work if run as root, among other things.

sudo reptyr -T $pid didn't work. It seems to freeze the terminal where the job I want to transfer is located, and on the destination terminal where I ran sudo reptyr -T $pid the process just hangs, but I can ctrl+c out of it.

I also had this same issue on Ubuntu 14.04, but it was solved by following the suggestion in the README:

echo 0 > /proc/sys/kernel/yama/ptrace_scope

and then executing reptyr as non-root (using the same user that initiated the process).

Faced this issue in ubuntu 16.04 but sudo reptyr -T $pid worked.

commented

It seems to freeze the terminal where the job I want to transfer is located, and on the destination terminal where I ran sudo reptyr -T $pid the process just hangs, but I can ctrl+c out of it.

Did you run fg to bring it to the foreground?