Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Make 'xhost +' work in iTerm Apps
To use setenv DISPLAY IP_number in iTerm, I had to add xhost + in the xterm terminal. But it just would not work in iTerm, even when trying to adapt PATH variables. This did work, though: Open .bash_profile in your favorite text editor, and add the following lines:
DISPLAY='localhost:0'<br>
export DISPLAY<br>
cd /usr/X11R6/bin/<br>
./xhost +<br>
cd
The cds to and from the directory are required; without them, it just doesn't seem to work. Save the file, quit the editor, and open a new terminal in iTerm, and it should work.
    •    
  • Currently 3.00 / 5
  You rated: 3 / 5 (3 votes cast)
 
[7,527 views]  

Make 'xhost +' work in iTerm | 3 comments | Create New Account
Click here to return to the 'Make 'xhost +' work in iTerm' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Make 'xhost +' work in iTerm
Authored by: EddEdmondson on Jun 27, '05 10:51:11AM
There's no guarantee the DISPLAY variable will be 0. Those who fast-user-switch in particular risk it being something else. Here's a script snippet that finds out what it should be and sets it appropriately:
X11_FOLDER=/tmp/.X11-unix
currentUser=`(set \`whoami\`; echo $1)`
bb=`ls -l $X11_FOLDER | grep $currentUser`
bbb=${bb/*X/:}
usedDISPLAY=$bbb.0
export DISPLAY=$usedDISPLAY
Credit for this goes to Dietrich Onnasch.

[ Reply to This | # ]
Make 'xhost +' work in iTerm
Authored by: pauljlucas on Jun 27, '05 12:26:59PM

"xhost +" is a Bad Idea because it opens up a huge security hole. You should use ssh's ability to port-forward X11 connections instead.

---
- Paul



[ Reply to This | # ]
Make 'xhost +' work in iTerm
Authored by: SOX on Jun 27, '05 01:40:30PM

using xhost + is generally a bad idea since it opens security holes. if you dont open any ports on your firewall then these holes are confined to local attacks only (and if you are the only local user then your fine). If you do open ports or have no firewall then remote attacks can happen.

Generally speaking xhost + is seldom needed.
instead consider ssh -Y or ssh -X
or if you must use xhost then at least specify the host name explicitly



[ Reply to This | # ]