login from cygwin to Mac OS X using xterm issue - macos

open cygwin shell
run ssh -Y user#MACOSXSERVER
No xauth data using fake authentication data for X11 forwarding <-- Warning
login MACOSXSERVER OK
set DISPLAY=CYGWINIP:0.0
xterm &
And I get the following error
Xlib: connection to "CYGWINIP:0.0" refused by server Xlib: No protocol specified
What went wrong?

You're rewriting the value of $DISPLAY as set by sshd. This is preventing X forwarding from working. Stop doing this.

running xhost + before run ssh solves this problem.

Related

Firefox in AWS instance

I tried to install firefox on my redhat 8 machine.but I get
" running firefox as root in a regular user's session is not supported. ($xauthority is /run/user/1001/gdm/xauthority which is owned by user.) "
Then I try it as normal user then it shows another error.
" Failed to open connection to "session" message bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Running without a11y support! "
How to install firefox in Rhel8 (AWS EC2)? Is this possible?
I assume you are connecting via ssh (text mode). Firefox needs a graphical environment to run, which is not available in EC2. You will need a text-only browser.
It seems to me that you need something like WorkSpaces, not ec2 with ssh.
https://docs.aws.amazon.com/workspaces/index.html
The minimum you also need to install with firefox would be the xauth package. This should let you run firefox both as a normal user and while su to root. As root you will need set the XAUTHORITY env variable to point to your .Xauthority file, e.g.
# export XAUTHORITY=/home/sbaby/.Xauthority
This assumes, of course, that you ssh to your server with a X11 server listening for connections. Refer to your ssh client for documentation on how to set that up.

VcXsrv host-based access control not working

All VcXsrv examples on internet is to run it with disabled access control, with '-ac' switch. But I'd actually like to turn on the host-based access control, so far not working.
First I launch VcXsrv from my windows 10 PC (latest build/patch) named pc1, with the -auth switch.
> "C:\Program Files\VcXsrv\vcxsrv.exe" :0 -multiwindow -clipboard -wgl -auth "C:\users\myname\hosts.txt"
In hosts.txt, I have the following, where linux1 is the remote host name
localhost
inet6:localhost
linux1
inet6:linux1
192.168.1.191
inet6:192.168.1.191
The ip addresses are linux1's.
However, when I launch xterm from linux1, I got this error
linux1$ /usr/bin/xterm -display pc1:0
Authorization required, but no authorization protocol specified
/usr/bin/xterm: Xt error: Can't open display: pc1:0
From pc1 loacally, when I run xhost, there is no mentioning of my remote host or its ip.
C:\Program Files\VcXsrv>xhost
access control enabled, only authorized clients can connect
INET:pc1.mshome.net
LOCAL:
INET:pc1
INET6:pc1
Therefore, looks like '-auth' didn't load the hosts.txt file
Can anyone share some ideas?
So -auth is for a different authentication/access control mechanism. To use host-based access control, run commands similar to the following, on your Windows 10 PC:
xhost +inet:localhost
xhost +inet6:localhost
xhost +inet:linux1
xhost +inet6:linux1
xhost +inet:192.168.1.191
(But no need to explicitly repeat the last line with inet6:, since that is specifically an IPv4 address.)
Then run xhost by itself again. The new hostname(s) and IP address(es) should now appear. And connecting from any of them to VcXsrv should now work.
Go to your vcxsrv installation dir, like C:\Program Files\VcXsrv.
Find a file named "X0.hosts"
Open it with notepad.exe.
Add the things you want!

GUI programs won't open in an ssh server. ssh -X and downloading XQuartz have not helped

So I use a remote server for some of my schoolwork and have no trouble logging onto the machine and navigating. The problem arises when I attempt to run a software that uses a GUI called ds9. It's used for image processing but I don't think that is relevant. Anyways, I've tried ssh -X username#university.edu, I've downloaded XQuartz, and I've made sure XQuartz's Security preferences are all checked. Still, I receive the same error message: Application initialization failed: no display name and no $DISPLAY environment variable
Unable to initialize window system.
I would be extremely grateful if anybody could identify the issue.
It may happened that you set a wrong DISPLAY env. var. at login time on the server. In general, ssh -X set the value to something like DISPLAY=localhost:10.0 (a tunnel set up by ssh in between your server and your local machine).

rsub with sublime and ssh connection refusual

I am trying to use rsub to create tunnel in ssh to sublime text, I run the command rmate .profile but i get the following response. I am using wateroof to open the ports 52968 on 1p4 and ip6, I followed the insturctions here and its just not working
I am running osx on my local machine and ubuntu 12.04 on my remote machine I am ssh into on digitalocean
root#anderskitson:~# rmate .profile
/usr/local/bin/rmate: connect: Connection refused
/usr/local/bin/rmate: line 186: /dev/tcp/localhost/52698: Connection refused
Unable to connect to TextMate on localhost:52698
I was having the same problem.
Let remoteHost = the IP or hostname of the machine you're attempting to ssh to.
I ran ssh -R 52698:localhost:52698 remoteHost from my local machine, after whice rmate .profile on remoteHost worked.
That led me to determine that ~/.ssh/config on my local machine was incorrect.
I set ~/.ssh/config to look like this:
Host remoteHost
RemoteForward 52698 localhost:52698
It's been working solidly since I made that change.
For anyone getting this same error using PuTTy on Windows, this commenter gives great instructions:
In PuTTy's config window, nagivate to the Connection > SSH > Tunnels pane
In the "Source Port" field, type 52698
In the "Destination" field, type 127.0.0.1:52698
Select the "Remote" and "Auto" radio buttons
Click the "Add" button
Go to the Session pane and save if you want to preserve these settings.
Here's an image which does the explaining visually:
I had the same issue and here is what works for me. If you have multiple servers you want this to work for, do the following as exactly shown here:
Host *
RemoteForward 52698 localhost:52698
I consulted this link: configure SSH config file and realized you can use * in config file.
Wildcards are also available to allow for options that should have a
broader scope.
I was trying to set this up for the first time using VS Code and got the generic "Connection refused" error even though my configuration seemed fine. It turned out to be because I hadn't reloaded the IDE after installing the rmate extension (Remote VSCode). Make sure that the rmate server is active on your local machine, whatever IDE you're using.
I had the same problem and fixed with replacing the HOSTNAME with the actual IP-Address when connecting:
e.g.: ssh pi#raspberrypi.local to ssh pi#192.168.1.1
I had the same problem and gone through most of the blogs, I did everything that was told.
At last, I found myself that textmate or submile editors are closed(force quit), this caused the problem.
For example my SSH config ~/.ssh/config file to connect with DigitalOcean with Remote Forward looks like:
Host DigitalOcean
Hostname xxx.xxx.xxx.xxx
User username
RemoteForward 52698 localhost:52698
and is called in a terminal
ssh DigitalOcean
rmate then connects fine with my local Atom editor
rmate stopped working for no apparent reason. Turns out I had tripped the 'man in the middle' check. I saw this warning when doing ssh --
\###########################################################
# WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! #
###########################################################
In my case, this warning was expected so I ignored it. This may not apply for you, so verify host identity. Didn't realize this line at the end of the warning --
Port forwarding is disabled to avoid man-in-the-middle attacks.
No wonder rmate stopped working. Verifying host identity and then clearing out offending entry from ~/.ssh/known_hosts made the warning go away and rmate started working again.
I run into this issue occasionally, and at least for my setup (which might be quite particular), I have found that killing zombie instances of ssh sessions does the job.
My particular setup :
I run Linux through a VM (VMWare Fusion) on my OSX host. Then I ssh into the the Linux host from OSX, and launch sublime from the Linux side. I usually have several ssh sessions running.
I recently rebooted my Mac (without first shutting down the VM, which was probably bad), and once I got back into the VM, was unable to launch Sublime - got the "connection refused" error mentioned by the OP.
So I did a ps aux on the Linux side, and looked for all instances of :
root 657399 0.0 0.1 13956 9332 ? Ss 14:52 0:00 sshd: user [priv]
user 657461 0.0 0.0 14088 5420 ? S 14:52 0:00 sshd: user#pts/1
(where user is my username). I killed the user jobs, e.g. 657461 above, and Voila! Every thing works now. Of course, in the process of killing these jobs, you are likely to kill the ssh session you are currently in, so you will have to log back into your session.
This might not work for users who don't have the necessary kill privileges on their remote machine, so don't know how useful this is, but thought I would put it out there.

Using tkdiff on windows with putty session

When I try to execute tkdiff inside my putty session. I get this message "Application initialization failed: no display name and no $DISPLAY environment variable" and it hangs. Please suggest how to configure tkdiff.
This is not a tkdiff problem. It means you don't have an X server (graphical window manager) running that putty knows about.
You have to at the very least go into putty's Connection / SSH / X11, and "Enable X11 forwarding". However, you also have to have an X11 server running on your system, which is more complicated.

Resources