Guest User

Untitled

a guest
Dec 13th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. from os import setsid, environ, fork, waitpid, WEXITSTATUS
  4. from subprocess import call
  5. from sys import argv, exit
  6.  
  7. pid = fork()
  8. if pid:
  9. # Parent
  10. status = waitpid(pid, 0)
  11. exit(WEXITSTATUS(status[1]))
  12. else:
  13. # We have to invoke SSH from a process with no controlling terminal
  14. # in order to get SSH_ASKPASS to work
  15. setsid()
  16. environ["DISPLAY"] = "0"
  17.  
  18. status = call(["/usr/bin/ssh"] + argv[1:])
  19. exit(status)
Add Comment
Please, Sign In to add comment