Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- from os import setsid, environ, fork, waitpid, WEXITSTATUS
- from subprocess import call
- from sys import argv, exit
- pid = fork()
- if pid:
- # Parent
- status = waitpid(pid, 0)
- exit(WEXITSTATUS(status[1]))
- else:
- # We have to invoke SSH from a process with no controlling terminal
- # in order to get SSH_ASKPASS to work
- setsid()
- environ["DISPLAY"] = "0"
- status = call(["/usr/bin/ssh"] + argv[1:])
- exit(status)
Add Comment
Please, Sign In to add comment