I am trying to rsync a directory from a remote machine to my laptop. The directory on the remote machine is not owned by the ssh user, hence I am trying to use sudo as explained here

Both machines are running macOS and have both ssh-askpass and XQuartz installed. X11Forwarding is working correctly, which I tested by running xeyes on the remote machine via SSH. The following command opened the window on my local machine.

ssh -X remotehost /opt/X11/bin/xeyes 

But when I run ssh-askpass on the remote machine, the prompt is opening on the remote machine, instead of forwarding it to the local machine.

ssh -X remotehost 'export SUDO_ASKPASS=/usr/local/bin/ssh-askpass; env; sudo -A ls'

Why isn't the ssh-askpass prompt forwarded to my local machine?


On Local Machine

$ echo $DISPLAY

On Remote Machine

$ env | fgrep DISPLAY
DISPLAY=<remote machine hostname>:10.0

$ sudo env | fgrep DISPLAY
DISPLAY=<remote machine hostname>:10.0
  • What is the value of the DISPLAY environment variable on the remote system? And what is the value of DISPLAY for commands run via sudo? – Kenster Jan 19 at 23:50
  • @Kenster I have added the details to the question. – Joyce Babu Jan 20 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.