$ cat /dev/tty cat: /dev/tty: Device busyHowever, that also means you cannot ssh out of the jail because ssh opens the terminal device when asking for password. One way to work around this is to use public key authentication. However, there is a simpler alternative, using an SSH_ASKPASS hack.
The manual page of ssh states that if both DISPLAY and SSH_ASKPASS are set, then the program specified by SSH_ASKPASS will run. The password is printed to standard output of the program. Instead of prompting for a password, we will write a script to echo the password out.
$ cat > ssh-login.sh #!/bin/bash echo open-sesame ^D $ chmod +x ssh-login.sh $ export DISPLAY=:0.0 $ SSH_ASKPASS=./ssh-login.sh ssh ...Obviously, SSH will still not be able to access the terminal, so any SSH functionality that involves a pseudo-terminal will not work. You will be able to access non-interactive commands, SFTP, and port forwarding this way.
No comments:
Post a Comment