Dear Linux masters....
My shell script to set display settings on linux server isnt working as expected! need your expert advise
#! /bin/bash xauth list > /home/usr1/utilities/xauthlist.txt #generates the list of display settings in xauth file display=$(tail -n 1 /home/usr1/utilities/xauthlist.txt) #reads & stores the last line of the xauthlist.txt sudo -iu admin1 xauth add $display #setting the display xterm #this command does not throw up any visual output
My mobaxterm gives the following error
MoTTY X11 proxy: Unsupported authorisation protocol xterm: Xt error: Can't open display: 10.161.28.189:14.0
On the contrary if I do the same thing manually (without the script), all works fine.
Simply, I am unable to mimic a ssh -c <cipher> <user>#<host> call with Remote SSH with VS Code. I allow the extension (Remote SSH) to auto-generate the config based off the input ssh command, yet the command is not replicated when the config file is sourced
The command output in VS Code's terminal
[Timestamp] Running script with connection command: ssh -T -D <5 digit Port> -F "<Path to Config File>" "<Host>" bash
The provided ssh command
ssh <user>#<host> -c <cipher>
And the auto-generated config contents inside VS Code
Host <hostname>
HostName <hostname>
User <user>
Cipher <cipher>
Any guesses on why the disconnect between the provided command, the generated config file and the output command? I am unable to find anything online with VS Code & SSH & Usage of Ciphers.
If important, this is from Windows 10 to a Linux box on an AWS workspace virtual machine, and I can ssh no problem from powershell as well as use remote interpeter within pycharm professional on the windows machine
Most of you certainly now the MacOS terminal emulator iTerm 2
I want to pass my environment variables which I've set/saved in ~/.ssh/environment to iTerm2, when it (the profile) is configured as default handler for this url-scheme. ( ssh://== )
Normal example ← works
You open the app iTerm2
Enter your ssh-command:
ssh hostname
It connects into your server and you can see with the command printenv your environment-variables you've put into your local ~/.ssh/environment file.
URL-Scheme example ← doesn't work
Some external application ( like the alfred-ssh workflow from deanishe) can access your .ssh/config file to make it easier to access all your configured hosts quickly and opens them then via url-scheme.
Because iTerm2 is configured for the ssh-scheme iTerm2 starts and connects quickly to the server.
You enter printenv and doesn't find your environment-varialbes.
You realize that iTerm2 started instantly and doesn't loaded the local environment-variables. Okay, I doesn't realized this at the beginning and created an issue for the workflow I used. But the developer is right, iTerm2 starts and isn't able to load the environment variables.
I've searched already several weeks for an solution, but wasn't able to solve this problem yet. That's why I'm asking here now.
My local SSH configuration (cleaned)
Content of ~/.ssh/environment is:
echo "RMATE_HOST=localhost" > sshenv
echo "RMATE_PORT=52699" > sshenv
Content of ~/.ssh/config is:
Host *
AddKeysToAgent yes
ServerAliveInterval 120
TCPKeepAlive no
UseKeychain yes
SendEnv RMATE_*
RemoteForward 52699 localhost:52699
Host personal
HostName personal.tld
IdentityFile ~/.ssh/keyFileName1
User user
Port 22
Host work
HostName business.tld
IdentityFile ~/.ssh/keyFileName2
User user
Port 22
And yeah, indeed! I just want to pass my RMATE variables to the servers via the workflow with Alfred ;-)
I have successfully installed mosh at server and client side both. I am trying to ssh using mosh from osx but it is throwing following error:
/bin/false: No such file or directory
write: Broken pipe
/usr/local/bin/mosh: Did not find remote IP address (is SSH ProxyCommand disabled?).
I am not sure if it has anything to do with mosh, or it is general error. Please help me in setting up mosh.
This error
/bin/false: No such file or directory
most likely means the user account that you are trying to login to is disabled. You need to log in as another user, and change the shell to a valid executable
$ chsh -s /bin/bash [username]
I am getting a error while accessing the firefox using X11Forwarding.
[root#station2 ~]# firefox
KiTTY X11 proxy: wrong authorisation protocol attemptedKiTTY X11 proxy: wrong authorisation protocol attemptedError: cannot open display: localhost:10.0
setup the following values: /etc/ssh/sshd_config
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
** Installed the package**
#yum install xorg-x11-xauth
#yum -y install xauth
[root#station2 .ssh]# echo $DISPLAY
localhost:10.0
#mkxauth -c
adding key for station2.example.com to /root/.Xauthority ... done
export XAUTHORITY=$HOME/.Xauthority
This fix worked for me
There is a hard, if not even impossible, to find (by search engine) scenario that may may cause that error message.
Preliminary note: The topic of this answer is not to discuss if it is a safety
risc or recommondable at all to use a graphical desktop as root on an remote, display-less, webserver.
Scenario:
A remote internet connected Linux server S has assigned the domain
name example.com to it's public IP4-address 192.0.2.1.
The /etc/hostname file on S contains the single line example.
The /etc/hosts
file on S contains the line 127.0.0.1 localhost example.com example.
The (remote) ssh access to S is by (sshd-) configuration (on S) forbidden
for root by the line DenyUsers root in /etc/ssh/sshd_config, but
allowed for a dummy user user1. From a client computer C a ssh
connection, using the ssh parameter -X or -Y, is established to S
as user user1.
Then, in a remote terminal on S owned by user1,
if any X11 related command is tried to be executed as root, may it be by
su, then trying to start the X11 desktop environment
or, as in the concrete case executing a script containing
#!/bin/bash
su --preserve-environment -c "xfce4-session &" root
the error message
X11 connection rejected because of wrong authentication.
is output and the start of any X11 related program fails.
The DISPLAY variable of root's environment contains
example.com:10.0
then.
One solution to the problem is, in this special case, to modify the line
127.0.0.1 localhost example.com example
in /etc/hosts to
127.0.0.1 localhost
Solution: run the application with the same user you are SSHing.
I have also encounter such errors while using X11.
The source of my problem was that i used SSH with my own username (which was not root).
Then, once logged in i tired running stuff with X11 while doing "su" or doing "sudo",
the problem with that is that the SSH session is configured with your own username - e.g: Raj, but then you switch to user root which is not part of the X11 session.
So what you should do is simply try to run the application (firefox in your case) with the same user you started the X11 session.
Hope this helps.
Talel.
I ran into this running gvim over ssh -t -Y and the solution that worked for me was:
xauth add $(xauth -f ~<logon_user>/.Xauthority list | tail -1) ; export NO_AT_BRIDGE=1 # gvim X11 fix for remote GUI failure after su
I do not know where I stumbled on this answer so I cannot give credit to the author.