How to choose DISPLAY port when forwarding X through ssh

خرید بک لینک

This is not a question about how to forward X through ssh or how to set DISPLAY so that the forwarded X works. That is a different question - if you wound up here looking for an answer to that just go 1 step further because 99% of X DISPLAY questions you'll find are for that.

My question is specifically how to choose the DISPLAY port. That is, if I do ssh -X ... then check DISPLAY with echo $DISPLAY, I might see localhost:10.0 or localhost:12.0 or something similar. It is not always the same each time, as in the previous example where it contains a 10 one time and a 12 some other time. How do I choose what that will be instead of letting it be semi-random each time? I want to force it to always choose 10.0 or always 12.0 or whatever, as long as it is consistent.

A solution to this preferably still works for multiple displays. I often have 2 or 3 X server displays - ie: localhost:10.0, localhost:10.1, localhost:10.2 - which ssh X successfully connects to and sets up. But again, it may use 10.0, 10.1, 10.2, or it may use 12.0, 12.1, 12.2. Whatever it is, I need it to be consistent.

My specific use case: I am using software at work which needs to know where to look for the displays. Each time ssh uses a different value for DISPLAY, I need to go into the config files for the software and manually change all the entries. It is a pain, and it really ought to be a set-and-forget kind of thing - hence my question.

I think this choice is made by ssh on the ssh server (X client) side. I don't think the X server knows or cares that, locally, the X client is considering it "10.0" or whatever it uses. Please correct me if I'm wrong, as I'm not sure.

I do not see any option for ssh to choose this value.

Preferably elevated privileges (root/admin) shouldn't be needed. I don't see why they would be for this, but I'm just stating that up front. If you have an answer which does require root, that is better than no answer and I might be able to use it.

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 243 تاريخ: شنبه 19 تير 1395 ساعت: 3:05

صفحه بندی