x2go Connection failed. bash: bash: command not found - ssh

I want to connect from my home pc with VPN (ubuntu-18.04) to work pc (ubuntu 18.04) using x2go.
Server side installation:
sudo add-apt-repository ppa:x2go/stable
sudo apt-get update
sudo apt-get install x2goserver x2goserver-xsession
Client side installation:
sudo apt-get install x2goclient
I am able to ssh to my remote desktop, but x2go doesn't work. Problem seems to be in the server side, since I tried to x2go connect from different computer (CentOs) and error was the same.
Client session preferences window:
I tried almost everything in session preferences, even with RSA key (I have it) or single application session type and many else, always the same error.
Client debug log: (x2goclient --debug)
x2go-INFO-1> "Starting X2Go Client 4.1.2.1..." x2go-WARNING-1> English
language requested, not loading translator. x2go-WARNING-1> English
language requested, not loading translator. Object::connect: No such
slot ONMainWindow::slotCheckAgentProcess() x2go-INFO-3> "Started X2Go
Client." x2go-DEBUG-../src/onmainwindow.cpp:563> "$HOME=/home/XXX"
x2go-DEBUG-../src/onmainwindow.cpp:2242> Reading 1 sessions from
config file. x2go-DEBUG-../src/sessionbutton.cpp:342> Creating QPixmap
with session icon: ":/img/icons/128x128/x2gosession.png".
x2go-DEBUG-../src/onmainwindow.cpp:12843> libssh not initialized yet.
Initializing. x2go-DEBUG-../src/onmainwindow.cpp:2728> Creating
QPixmap with session icon: '":/img/icons/128x128/x2gosession.png"'.
x2go-DEBUG-../src/onmainwindow.cpp:2795> Starting session via Smart
Card, SSH Agent or Kerberos token. x2go-INFO-8> "Starting connection
to server: 192.168.29.15:22" x2go-DEBUG-../src/onmainwindow.cpp:2829>
Starting new ssh connection to server:"192.168.29.15":"22" krbLogin:
false x2go-DEBUG-../src/sshmasterconnection.cpp:175>
SshMasterConnection, host "192.168.29.15"; port 22; user "XXX";
useproxy false; proxyserver "192.168.29.15"; proxyport 22
x2go-DEBUG-../src/sshmasterconnection.cpp:248> Starting SSH connection
without Kerberos authentication.
x2go-DEBUG-../src/sshmasterconnection.cpp:252> SshMasterConnection,
instance SshMasterConnection(0x56102247dbe0) created.
x2go-DEBUG-../src/sshmasterconnection.cpp:520> SshMasterConnection,
instance SshMasterConnection(0x56102247dbe0) entering thread.
x2go-DEBUG-../src/sshmasterconnection.cpp:840> Session port before
config file parse: 22 x2go-DEBUG-../src/sshmasterconnection.cpp:850>
Session port after config file parse: 22
x2go-DEBUG-../src/sshmasterconnection.cpp:915> Session port before
config file parse (part 2): 22
x2go-DEBUG-../src/sshmasterconnection.cpp:925> Session port after
config file parse (part 2): 22
x2go-DEBUG-../src/sshmasterconnection.cpp:950> cserverAuth
x2go-DEBUG-../src/sshmasterconnection.cpp:991> state: 1
x2go-DEBUG-../src/sshmasterconnection.cpp:1364> userAuthAuto failed:""
(code 1)
x2go-DEBUG-../src/sshmasterconnection.cpp:1274> Trying password
mechanism if available.
x2go-DEBUG-../src/sshmasterconnection.cpp:1278> Password mechanism
available. Continuing.
x2go-DEBUG-../src/sshmasterconnection.cpp:726> User authentication OK.
x2go-DEBUG-../src/sshmasterconnection.cpp:1789> LOGIN CHECK:"LOGIN OK
" x2go-DEBUG-../src/sshmasterconnection.cpp:1792> don't have
interaction x2go-DEBUG-../src/sshmasterconnection.cpp:1825> LOOP
FINISHED x2go-DEBUG-../src/sshmasterconnection.cpp:1829> No
interaction needed, continue session
x2go-DEBUG-../src/sshmasterconnection.cpp:735> Login Check - OK
x2go-DEBUG-../src/onmainwindow.cpp:2923> SSH connection established.
x2go-DEBUG-../src/onmainwindow.cpp:3336> Continue normal X2Go session
x2go-DEBUG-../src/sshprocess.cpp:199> Executing remote command via
SshProcess object 0: "x2golistsessions"
x2go-DEBUG-../src/sshprocess.cpp:213> this=SshProcess(0x5610224a1f30)
Running masterCon->addChannelConnection(this, '
"1d4dfc1a-7f4d-4f00-b39e-07273d3d973d" ', ' "bash -l -c 'echo
"X2GODATABEGIN:1d4dfc1a-7f4d-4f00-b39e-07273d3d973d"; export
PATH="/usr/local/bin:/usr/bin:/bin";export TERM="dumb";
x2golistsessions; echo "X2GODATAEND:1d4dfc1a-7f4d-4f00-b39e-07273d"
'); x2go-DEBUG-../src/sshmasterconnection.cpp:1891> Locking SSH
channel connection MUTEX.
x2go-DEBUG-../src/sshmasterconnection.cpp:1893> Passing new channel
connection object to channelConnections.
x2go-DEBUG-../src/sshmasterconnection.cpp:1895> Unlocking SSH channel
connection MUTEX. x2go-DEBUG-../src/sshmasterconnection.cpp:2083>
Creating new channel.
x2go-DEBUG-../src/sshmasterconnection.cpp:2100> New
channel:0x7fcf84012aa0
x2go-DEBUG-../src/sshmasterconnection.cpp:2185> Executing remote:
"bash -l -c 'echo
"X2GODATABEGIN:1d4dfc1a-7f4d-4f00-b39e-07273d3d973d"; export
PATH="/usr/local/bin:/usr/bin:/bin";export TERM="dumb";
x2golistsessions; echo
"X2GODATAEND:1d4dfc1a-7f4d-4f00-b39e-07273d3d973d";'"
x2go-DEBUG-../src/sshmasterconnection.cpp:2208> New exec channel
created.
x2go-DEBUG-../src/sshmasterconnection.cpp:2257> EOF on channel
0x7fcf84012aa0; SshProcess object: 0
x2go-DEBUG-../src/sshmasterconnection.cpp:2380> EOF sent.
x2go-DEBUG-../src/sshmasterconnection.cpp:2384> Channel closed.
x2go-DEBUG-../src/sshprocess.cpp:526> SSH finished: raw output
(stdout): "" x2go-DEBUG-../src/sshprocess.cpp:532> Have stderr only,
something must be wrong. x2go-DEBUG-../src/sshprocess.cpp:537> SSH
finished: false - "bash: bash: command not found " (0).
x2go-DEBUG-../src/onmainwindow.cpp:3804> "bash: bash: command not
found
If someone was interested, I can show server's side /var/log/syslog
Thank you for your help

Please try moving your .bashrc aside and retry.

It was my bad, silly me. I had a typo in /etc/environment file and I didn't notice it because I haven't restarted my PC after that typo. After fixing it, it worked.

Related

kex_exchange_identification: Connection closed by remote host

I've wanted to connect my share hosting with ssh. So I generate an ssh key in the ssh action of cpanel and authorized it. Then I've downloaded the private key and drop it in the ./ssh folder of my MacBook.I've used this code to connect my host.
ssh -p 2083 username#host IP
but I got this error:
kex_exchange_identification: Connection closed by remote host
How can I solve my problem?
I run into a similar case with a small computer I have in my desk. What I did to debug the issue was to run sshd -t, which runs the sshd daemon in debug mode. This command reported that the permissions of my keys were invalid. All I had to do then was to go in the folder where the keys are stored and issue chmod 0600 <your_ssh_keys>.
Maybe the action you run generated things with the wrong permissions too.
I got this error when using docker command with remote host
docker -H ssh://user#server compose up
after some digging i found on my remote server in auth logs (/var/log/auth.log) this:
Aug 8 14:51:46 user sshd[1341]: error: beginning MaxStartups throttling
Aug 8 14:51:46 user sshd[1341]: drop connection #10 from [some_ip]:32992 on [some_ip]:22 past MaxStartups
This lead me to change MaxStartups settings in /etc/ssh/sshd_config. After restarting ssh service everything worked like a charm.
I had same problem and it was happend as I use ProxyCommand in ssh config file. In my case the Host was not defined correctly which then caused the same error!

AEROSPIKE_ERR_CONNECTION Bad file descriptor, 127.0.0.1:3000; Not able to connect to local node from aql

I have installed aerospike on my mac my following this installation steps
All the validations are working fine. I am able to connect to the cluster using browser chrome. Below is the screen shot.
I have also installed the AQL tools following the instructions here.
But I'm unable to connect to local node from aql.
$ aql
2017-11-21 16:06:09 WARN Failed to connect to seed 127.0.0.1 3000.
AEROSPIKE_ERR_CONNECTION Bad file descriptor, 127.0.0.1:3000
Error -1: Failed to connect
$ asadm
Aerospike Interactive Shell, version 0.1.11
ERROR: Not able to connect any cluster.
Also, I have noticed the Java client is giving error.
AerospikeClient client = new AerospikeClient("localhost", 3000);
when I changed the localhost to actual Ip returned by vagrant ssh -c "ip addr"|grep 'global eth1' it is working fine.
How to connect with aql using customer parameters? I want to pass ip address and port as parameters to aql. Any suggestions.
$ aql --help
https://www.aerospike.com/docs/tools/aql/index.html - discusses all various command line options.
$ aql -h a.b.c.d -p 1234
There is another possibility, you have your owned port instead of the default 3000, so when you try to connect to aerospike, you can try to run command like : aql -p4000
Hope this may help you
Seems like the port is not getting freed even after exiting the vagrant console.
Tried closing all the terminal windows and then starting again. But no luck.
Finally, restarting the system resolved the issue.

glassfish4 create-node-ssh failed due to ssh key exchange not finished

I'm trying to create a node on a remote host(I've already created a domain).
I'm running the command:
asadmin -p <port_number> create-node-ssh --nodehost <remote_hostname> --installdir <glassfish_installed_dir_path> <node_name>
and getting the following error everytime:
remote failure: Warning: some parameters appear to be invalid.
SSH node not created. To force creation of the node with these parameters rerun the command using the --force option.
Could not connect to host <hostname> using SSH.
There was a problem while connecting to <hostname>:22
Key exchange was not finished, connection is closed.
Command create-node-ssh failed.
From the error it seems that there is some connection problem. But I can ssh to the target server and I'm using the same key_pair.
After searching for some solution (link1, link2) I found that trying to login through ssh without password could solve this.
But no luck. Now I can ssh to & from the target server without password as well. But this issue is still there.
What should I check for, in order to resolve this ?
Let me know if I'm missing out anything.
Can you try to start sshd daemon in debug mode to a different port at the remote node host:
sudo sshd -D -d -e -p 23
and try create-node-ssh command against that ssh port?:
asadmin -p <port_number> create-node-ssh --nodehost <remote_hostname> --installdir <glassfish_installed_dir_path> --sshport 23 <node_name>
I had an issue regarding glassfish ssh exchange keys because of ssh newer versions deprecating older algorithms:
Unable to negotiate with X.X.X.X port XXXXX: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 [preauth]
My solution was to add legacy keys to /etc/ssh/sshd_config:
KexAlgorithms +diffie-hellman-group1-sha1
Ciphers +aes128-cbc
Even if this is not your case, sshd debug will surelly give you more information.

Ansible: "sudo: a password is required\r\n" [duplicate]

This question already has an answer here:
How can a user with SSH keys authentication have sudo powers in Ansible? [duplicate]
(1 answer)
Closed 5 years ago.
quick question
I have setup an Ubuntu server with a user named test. I copy the authorized_keys to it, I can ssh no problem.
If I do $ ansible -m ping ubu1, no problem I get a response
<i><p>ubu1 | SUCCESS => {
<br>"changed": false,
<br>"ping": "pong"
<br>}</i>
What I dont get is this, If I do
$ ansible-playbook -vvvv Playbooks/htopInstall.yml
fatal: [ubu1]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_name": "setup"}, "module_stderr": "OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g-fips 1 Mar 2016\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 6109\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\nShared connection to 192.168.1.112 closed.\r\n", "module_stdout": "sudo: a password is required\r\n", "msg": "MODULE FAILURE", "parsed": false}
If I do $ ansible-playbook --ask-sudo-pass Playbooks/htopInstall.yml, then it ask my user password and the play is a success.
If I rename the authorized_keys it tells me I "Failed to connect to the host via ssh." which is ok.
What I dont understand is why is it asking for a sudo password. I definetly missed something along the way.
my ansible.cfg file looks like this
[defaults]
nocows = 1
inventory = ./Playbooks/hosts
remote_user = test
private_key_file = /home/test/.ssh/id_ubu
host_key_checking = false
my hosts file looks like this
[servers]
ubu1 ansible_ssh_host=192.168.1.112 ansible_ssh_user=test
What I dont understand is why is it asking for a sudo password.
We can't say for certain without seeing your playbook, but it's almost certainly because a) your playbook asks Ansible to run a particular command with sudo (via the sudo or become directives) and b) the test user does not have password-less sudo enabled.
It sounds like you are aware of (a) but are confused about (b); specifically, what I'm picking up is that you don't understand the difference between ssh authentication and sudo authentication. Again, without more information I can't confirm if this is the case, but I'll take a stab at explaining it in case I guessed correctly.
When you connect to a machine via ssh, there are two primary ways in which sshd authenticates you and allows you to log in as a particular user. The first is to ask for the account's password, which is hands off to the system, and allows a login if it was correct. The second is through public-key cryptography, in which you prove that you have access to a private key that corresponds to a public key fingerprint in ~/.ssh/authorized_keys. Passing sshd's authentication checks gives you a shell on the machine.
When you invoke a command with sudo, you're asking sudo to elevate your privileges beyond what the account normally gets. This is an entirely different system, with rules defined in /etc/sudoers (which you should edit using sudo visudo) that control which users are allowed to use sudo, what commands they should be able to run, whether they need to re-enter their password or not when using the command, and a variety of other configuration options.
When you run the playbook normally, Ansible is presented with a sudo prompt and doesn't know how to continue - it doesn't know the account password. That's why --ask-sudo-pass exists: you're giving the password to Ansible so that it can pass it on to sudo when prompted. If you don't want to have to type this every time and you've decided it's within your security parameters to allow anyone logged in as the test user to perform any action as root, then you can consult man sudoers on how to set passwordless sudo for that account.
I solved this exact error sudo: a password is required\n which I got when running my playbook with become: true but somewhere in a task delegating to localhost, something like this:
uri:
url: "{{ some_url }}"
return_content: yes
status_code: 200
delegate_to: 127.0.0.1
If I understood correctly, the become: true causes Ansible to log into the remote host as my user and then use sudo in order to execute all commands on the remote host as root. Now when delegating to 127.0.0.1, sudo is also executed and as it happens that on my localhost a password is expected when using sudo.
For me the solution was simply to remove the delegate_to, which was not actually needed in that particular use case.

Docker: SSH freezes on login

I can succefully login to server using ssh 111.111.111.111 without password. But after multiple ssh login, I can't access server for some while(it freezes when I try to login).
To tell the whole story I'm trying to create generic docker machine using following lines.
docker-machine create\
--driver generic\
--generic-ip-address=111.111.111.111\
srv
All of the errors are ssh related, and they are quite randomly at different stages:
Error getting SSH command: Something went wrong running an SSH command!
command : cat /etc/os-release
err : exit status 255
output :
or:
if ! type docker; then curl -sSL https://get.docker.com | sh -; fi
SSH cmd err, output: exit status 255:
error installing docker:
After any of these error I can't login for somewhile. Please let me know if any log or confs is needed.
Since docker executes procedures via separate ssh command, somehow my provider detected me as an intruder for brute force attacks, changing the ssh port on remote server solved the problem.
Please view another question that I asked at
SSH parallel command execution freeze for this matter.