nelhage / reptyr

Reparent a running program to a new terminal
MIT License
5.77k stars 216 forks source link

Works in any Linux terminal? #62

Open trusktr opened 9 years ago

trusktr commented 9 years ago

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
nelhage commented 9 years ago

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.

trusktr commented 9 years ago

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.

1j commented 7 years ago

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).

xrage commented 7 years ago

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

heyakyra commented 4 years ago

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?