From: Ian Jackson Date: Thu, 7 Jun 2018 16:33:34 +0000 (+0100) Subject: fishdescriptor: Work if child is not running as root, but we are X-Git-Tag: archive/debian/6.0.2_bpo9+1^2~4 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=62e1d54313a88457b281d85e8ab6a2559192f680;p=chiark-utils.git fishdescriptor: Work if child is not running as root, but we are We make a socket, normally in /var/run/user for the victim process, which is therefore accessible only to the victim uid (and to root). If we are running as root, the socket will typically not be writeable by the user, and this will fail. We need to chmod it. Signed-off-by: Ian Jackson --- diff --git a/fishdescriptor/py/fishdescriptor/fish.py b/fishdescriptor/py/fishdescriptor/fish.py index 0f180bc..b47ac3d 100644 --- a/fishdescriptor/py/fishdescriptor/fish.py +++ b/fishdescriptor/py/fishdescriptor/fish.py @@ -154,6 +154,7 @@ class Donor(): s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s.bind(our_sockname) + os.chmod(our_sockname, 666) s.listen(1) ancil_len = d.donate(our_sockname, fds)