how do you get X-windows when you log on though ssh?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how do you get X-windows when you log on though ssh?
I resently loaded ssh on my slackware and i got it running. I am currently using putty to get into my box over the network. I was just wondering thou is there away to run the KDE X Windows system while logged in with SSH though putty? I tried typing startx but all it does is give me a read out of commands on the screen.
Let me try to guess those errors: it must be something related to the DISPLAY environment variable, if not then I can just write according to my experience how it worked by me ..
First of all startx is for starting the X-server, if it is already started on the remote site, then u ll surely be pointed that it is already a X running there. I don't know about vnc concept:
From now on refer <remotehost> to the hostname/ip of the host where the remote host is without <>, n refer <localhost> to the hostname or ip of ur running slack without <>.
X-server, shh-server must already running on remote side. Then run startx on ur <localhost>, pop out a xterm or konsole, type: xhost +<remotehost>, then log into <remotehost> with: ssh <remotehost>.
After loged in, now u r in the remoteshell. Wut u need now is to set the environment variable DISPLAY of the remoteshell to use the display of the <localhost>. To see the defined environment variables of the remoteshell just type: env
Now, type in the remoteshell:
xhost +<localhost> export DISPLAY=<localhost>:0
If ur default shell on the remoteshell is tcsh, then type:
setenv DISPLAY <localhost>:0
If thing functioned well, u ll then able to call the remote X-clients to run on ur local slcak, like: xterm, netscape, mozilla, ... just try out.
If the remotehost is solaris, I just put this below on my ~/.bashrc on <remote account> to automatically do the story above.
if [ $REMOTEHOST ]; then
/usr/X11R6/bin/xhost +$REMOTEHOST export DISPLAY=$REMOTE_HOST:0
fi
For csh/tcsh shell put below on ~/.cshrc
if ( $REMOTEHOST ) then
/usr/X11R6/bin/xhost +$REMOTEHOST
setenv DISPLAY $REMOTEHOST:0
endif
That must be in the remote site, not on local (where slack running)!
That is the common concept with X-server, X-client. It is possible because X is designed to be transparent. U can even ssh from xterm invoked from the <1st-remotehost> to another host <2nd-remotehost> every where on the internet where u have shell-account, as long as X-server is running there. Then just do the set DISPLAY variable procedure like above.
Note:
It is normal to set the DISPLAY of <2nd remotehost> to the display of ur <localhost> (where slack is running). But it is also possible to set it to the display of the <1st remotehost>, wut meant wut u invoke from the <shell of the 2n remotehost> will be pop out on the screen of the <1st remotehost> if someone ist running X-client on there, supposed he/she didn't blocked the screen with the authority-cookie (xauth uses ~/.Xauthority). But most likely his/her screen will already protected from this scene, when he/she started X with the startx script. Startx start invoke xinit, which in turn will start /usr/X11R6/bin/xauth somewhere normally .. (See those /usr/X11R6/lib/xinit/*) ..
By microsoft platforms, that means u ll run like ms-word.. from a window-server (somewhere on the internet) n have it displayed on ur local screen. They call it vpn, likely, am not sure. But is it possible to invoke another client from a 2nd server from within the 1st-terminal/shell of the 1st-server on vpn ?
The X-client/server concept worked since the X released maybe even since release X11R5 or even R4 or R3 .. back to 1980 .. ..
So that scene should work for common X-clients, I don't know whether u can have kde/gnome clients running through .., afaik kde/gnome sit only above the X-server. If not I ll not comment further..
Last edited by linuxJaver; 07-08-2003 at 08:27 AM.
I think he wants to know if it's possible to view X on a Windows machine, which he is using to SSH into his linux box.
Something like that MAY work for cygwin, but you would have to install ssh on cygwin and use THAT to connect to your remote box. You would have to start up X from cygwin, and then open up a terminal and ssh into your linux box and do the stuff with the DISPLAY variable to point X apps from that machine to your local machine's X session running on cygwin. I've never done something like that before though so I am not positive it would work.
If you are new to working with the Windows and Linux / Unix connectivity issue, there are two excellent articles we recommend you to start with. The first one, "Windows onto Linux" is written by Ashton Mills for APC Magazine. (Please be patient - the link might take few seconds to open.) The second article, "WinaXe: Linux Hand in Hand with Windows", written by Dinesh Yadav, was featured in the LinuxForYou Magazine in March 2003. Now that you have familiarized yourself with WinaXe, you are ready to download and try the software. After having fun with the trial version, you are propably eager to take the last step: Purchase the license!."
The other link is a pdf that is similair to the html version.
Code:
Last login: Mon Jul 07 2003 20:18:38 -0800 from dhcp166-193.cal
Sun Microsystems Inc. SunOS 5.8 Generic February 2000
No mail.
Sun Microsystems Inc. SunOS 5.8 Generic February 2000
TERM = xterm
Filesystem usage quota limit timeleft files quota limit timeleft
4134 10000 10300 754 20000 20600
bash-2.03$ uname -a
SunOS mars 5.8 Generic_108528-19 sun4u sparc SUNW,Ultra-Enterprise
The code above is the login prompt of the SunOS Solaris 8.0 I use through ssh. But, a program we use to get the GUI desktop of the SunOS CDE 1.4 is a program called XSession or WinaXe from www.labf.com We can have both the Windows GUI with the SunOS GUI.
Linux has a GUI login, but needs to be configured called X11. The site with the articles describes the setup as well.
No, don't use xhost. Not secure at all. The whole point of ssh is secure remote logins. An added bonus is that ssh handles all the $DISPLAY stuff for you, so you don't have to touch it.
I had the same problem, and here's how I did it after STFWing.
First, install Cygwin on your Windows machine. http://www.cygwin.com/ Make sure to install the X environment, the ssh library (I believe it's called openssh or openssl or some such), and bash (you don't have to but I just like it).
Obviously, make sure that your Linux box is running sshd, which will listen for incoming ssh connections. ps or ncps will tell you if you are. If not, start it. Also be sure to enable packet forwarding. Go into /etc/ssh/sshd_config
and set the following:
This (after some thinking) will put you into a familiar grey-looking X and some bash sessions. If you get error messages, reinstall Cygwin and make sure you have the components I mentioned above. Then issue
ssh -X your_Linux_box_ip_address_or_domain
This tells ssh to forward X packets from your Linux box to the X session under Cygwin. Consult man ssh for more info.
This is it. Test it:
xeyes
If you get connection refused messages, make sure sshd is configured properly. Again, man ssh.
I've just looked on the manual page of ssh (man ssh). I remembered the last time I hooked on a remote solaris machine from slack. The server forced me to create such keys something, I need to just do it once for each host I try to connect to. The key creation is forced automatically during the ssh session.
After login, the channel is already encrypted, save from spoofing issues. I'ven't tried those X11* stuff config (dun know whether those functioned on linux not cygwin, I mean if I've to use cygwin to get unix environment, then I ll better forget about using unix at all, sorry for me pc is good when it can be configured to be like unix machine, with those unix-commands, bash/tcsh natively... Therefore ms-boxes ll be good enough if they implement all unix commands n support bash/tcsh natively not command.com or cmd.exe...
If such X11* stuff configuration on ssh work, they r surely the prefered option. Afaik xhost is just for telling the remote X-server to add localhost to his "network-neigbour", but all data is already encrypted by ssh through the channel, isn't it ? Can try both without n without ..
But please not with cygwin, please. I prefered postgressSql over mySql, but on Window postgressSql only works on cygwin, that have demotivated me for awhile ..
Since 3, ..2 years ago I back from linux to use winodws, bcoz it is so hard to get linux-boxes to get connected to internet, etc, etc .. But I wondered, during the last installation of slack9, rh9, I got hooked on internet immediately after the installation..
That mean it is now the prime time to forget the ms-boxes, but not at all. I still need them to test java thingies, most web clients still running on ms-boxes... That is wut they actually good for, from now on !!!
Last edited by linuxJaver; 07-08-2003 at 09:26 AM.
Originally posted by linuxJaver
I've just looked on the manual page of ssh (man ssh). I remembered the last time I hooked on a remote solaris machine from slack. The server forced me to create such keys something, I need to just do it once for each host I try to connect to. The key creation is forced automatically during the ssh session.
Yes, this is standard ssh authentication, which is really the point of using ssh.
Quote:
After login, the channel is already encrypted, save from spoofing issues. I'ven't tried those X11* stuff config (dun know whether those functioned on linux not cygwin, I mean if I've to use cygwin to get unix environment, then I ll better forget about using unix at all, sorry for me pc is good when it can be configured to be like unix machine, with those unix-commands, bash/tcsh natively... Therefore ms-boxes ll be good enough if they implement all unix commands n support bash/tcsh natively not command.com or cmd.exe...
Well, I suppose to each his own. However, the question here really is, given a Windows and a Linux machine, how do we get them to exchange X packets? One solution is to wait N years for Microsoft to implement X natively in Windows. Another is to use a POSIX-type layer under Windows. Cygwin is just one of them, and I use it because it happen to works for me. I am sure there are other tools that achieve the same goal, but I don't believe you can do away with such tools completely.
Quote:
If such X11* stuff configuration on ssh work, they r surely the prefered option. Afaik xhost is just for telling the remote X-server to add localhost to his "network-neigbour", but all data is already encrypted by ssh through the channel, isn't it ? Can try both without n without ..
It certainly works, that's how I log into my computer every day from work.
xhost isn't the best way to do it. When you do
xhost +remotehost
anybody with half a brain can pretend to be that remotehost and get access to your X environment. Better yet, why not do
xhost +
and put up a welcome sign?
It is much harder to do so if you are using ssh, in which case you don't need xhost at all.
Another handy thing port forwarding via ssh can do is that it is not limited to Box L --> Box W. You can have a rather large number of computers in between, something like this:
Box L1 --> Box L2 --> Box L3 --> .. > Box W
I actually use this as well - I am behind a firewall which doesn't allow outgoing connections on 22 to some hosts, but if I ssh to a trusted host first, I can ssh into my home computer from there, and X packets are forwarded merrily. You can try to set $DISPLAYs on all these machines (what if Box L2 doesn't have an X environment at all?), or use ssh and save yourself a lot of time.
After login, the channel is already encrypted, save from spoofing issues. I'ven't tried those X11* stuff config (dun know whether those functioned on linux not cygwin, I mean if I've to use cygwin to get unix environment, then I ll better forget about using unix at all, sorry for me pc is good when it can be configured to be like unix machine, with those unix-commands, bash/tcsh natively... Therefore ms-boxes ll be good enough if they implement all unix commands n support bash/tcsh natively not command.com or cmd.exe...
Well, I suppose to teach his own. However, the question here really is, given a Windows and a Linux machine, how do we get them to exchange X packets? One solution is to wait N years for Microsoft to implement X natively in Windows. Another is to use a POSIX-type layer under Windows. Cygwin is just one of them, and I use it because it happen to works for me. I am sure there are other tools that achieve the same goal, but I don't believe you can do away with such tools completely.
No, the 1st question is not about connecting from a window-box to a remote X-server, but from slack ... Am not against Cygwin, it is cool that they made it so far that ppl can even have the X enviroment on a window-box, wut I meant is if one is considering to work seriously with unix environment (using X-client/server should be considered to be) then instead of to have such emulaaated linux environment, one should consider to have the real box installed.
I just gonna introduced the X-client/server concept, if ssh enabled the xhost feature then it is naturaly preferable..
Quote:
Box L1 --> Box L2 --> Box L3 --> .. > Box W
I actually use this as well - I am behind a firewall which doesn't allow outgoing connections on 22 to some hosts, but if I ssh to a trusted host first, I can ssh into my home computer from there, and X packets are forwarded merrily. You can try to set $DISPLAYs on all these machines (what if Box L2 doesn't have an X environment at all?), or use ssh and save yourself a lot of time.
Box L2 must have unix/linux(like)-enviroment n sshd running for the scene, but there is no requirement that that X must be started on L2 if u wonna tunnel through L2 to L3/L4... That only apply when say u want ur x-client from L3/L4.. to pop out on the screen of L2-box (like to annoy one working on that L2-screen). But for tunneling purpose, u don't need X-environmen running.
If u don't want X-client to pop out on L2 u don't need to set the DISPLAY variable on L3/L4.. at all. Just tunnel further to L3/L4../Lx. Then at Lx u can set DISPLAY to the display of L1 for comfortability. Then u can pop out X-clients to L1. If u like to give the option on each X-client command, then u don't need to set the variable DISPLAY. Just type: xterm -display L1-host:0, netscape -display L1-host:0 oh yeah, I forgeted: xeyes -display L1-host:0
Ok, this is what I understand so far from this thread.
remote_PC <-> local_PC
This is assuming the form of communication '<->' between machines is either through a LAN or WAN with 'high bandwidth' So, the following communications are possible for graphical or textmode log in.
example:
windows <-> windows
(OS range from 95 through XP)
linux <-> linux or unix <-> unix
(assuming both machines have identical Linux distros)
This is where it gets really complicated.
windows <-> linux
linux <-> unix
windows <-> unix
To have the different operating systems to see each other on a LAN or WAN and still be able to log in remotely. So, is it possible with the pre-packaged on Linux distros to have the different OS's to communicate? How much time and effort is going to be placed in this little bit of exploring? How much room would someone need?
I am currently working with Redhat, Mandrake, Win98, Win2K, and WinXP. I still need to place the LAN for the boxes to communicate via network. Then comes the fun part of configuring them all to 'see' each other. I have read post of users having their own local network at home. So, any advice? Should I try to get operating systems to see each other?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.