Contents
- 1 Why does SSH hang when executing command remotely?
- 2 Can You Send More than one remote command over SSH?
- 3 How to load environment variables in ssh connect?
- 4 Why does Java runtime.exec hang in Stack Overflow?
- 5 How to connect to a remote server using SSH2?
- 6 Is there a way to kill a hung SSH session?
- 7 Why does my SSH server keep dropping packets?
Why does SSH hang when executing command remotely?
Authentication is not the problem, may it be made by SSH keys or password. It hangs there. Then after a random time, it works again (without doing anything). Killing all sshd process on the server seems to work too.
Why does LS on remote via SSH not work?
The command is as This command get stuck in between and finally we have to suspend it. But, executing the command ssh machine -l user works fine and this command makes us connect to remote machine. Can someone please help in getting the root cause of why the ls on remote server doesn’t work by ssh.
Can You Send More than one remote command over SSH?
Reboot the remote server: In the most cases it is not enough to send only one remote command over SSH. Much more often it is required to send multiple commands on a remote server, for example, to collect some data for inventory and get back the result.
How to run bash script on a remote server?
SSH: Run Bash Script on Remote Server. The equally common situation, when there is some Bash script on a Linux machine and it needs to connect from it over SSH to another Linux machine and run this script there.
How to load environment variables in ssh connect?
It works for me. The ssh connect open an no-interactive shell. So it will load the environment variables for an non-interactive shell if you comment or delete this block codes. Alternatively, you can just put all of your required environment lines code above that line.
Why is my command not found when using SSH?
Using the full command or any other parameters in my ssh command is not an option in my scenario. My command is executed by a script I cannot touch and worked on every host yet except this one.
Why does Java runtime.exec hang in Stack Overflow?
The problem is that the process you are trying to execute may (depending on lot of things) either first write to stdOut or stdErr. If you handle them in wrong order exec will hang. To handle this properly always you must create 2 threads to read stdErr and stdOut simulteneously.
How can I tell if my SSH is hanging?
Check the ssh on the server side. You may “strace” the created process / mail sshd process and see what syscalls is it calling. This should give you more info on what is it doing. Also try “touch /tmp/randomfile” and see if the hangs happens after it get created or afterwards.
How to connect to a remote server using SSH2?
I am new to this kind of Java application and looking for some sample code on how to connect to a remote server using SSH , execute commands, and get output back using Java as programming language. JSch is a pure Java implementation of SSH2 that helps you run commands on remote machines. You can find it here, and there are some examples here.
What causes SSH server to hang after authentication?
There are several things that can cause a hang right after SSH authentication. As Iain mentioned, any user login scripts. Too many processes running / restarting. Something has fork()’d too many child-processes and the load (the 1/5/15 score) is too high.
Is there a way to kill a hung SSH session?
The timeout will kill the session/command even if the session is not in hung state. Here the benefit is that if for automation you are using ssh command and you do not wish the automation script to get stuck during execution then you can use timeout command to kill the session after certain period of time.
Why is my SSH connection blocked on my computer?
You may be hitting an SSH rate limiter on the server-side network. This is a firewall technique to block IP addresses that have too many new connection requests within a short period of time. Then the source IP is blocked for a defined period of time. Check the ssh on the server side.
Why does my SSH server keep dropping packets?
The ssh client sets the DSCP field with the setsockopt () system call (which I verified in the source) A faulty configuration on a VPN at my employer was dropping the packets with the DSCP of 0x8, causing all non-interactive ssh traffic to also get dropped.