Kill port on remote server with ssh - linux

I want kill specific port on remote host with below command:
ssh username#remoteip "fuser -k 2323/tcp"
but got fuser: command not found error. I spent hours googling for this but I could not find any possible solution.
Any idea?
my linux distribution: centos

The error message says it all: The command fuser is not available.
You have to install the package psmisc:
yum install psmisc

Related

Provide services from within docker container to host under Windows

Continue on with Docker host network container service access under Windows,
I am having a hard time trying to expose services in the Linux container (i.e. their ports) so that they can be directly accessed from host.
If the host is Linux, I know a whole spectrum of tools to troubleshoot the situation. But when it comes to Windows host, I don't know where to start and how to troubleshoot step by step.
I'm starting docker with -p 3999:3999 on Windows, and within the Linux container I'm starting a Go based web service listening on 0.0.0.0:3999. These are the things I have been doing without any issue when the host is Linux. Now the only difference is,
The host is now Windows
It may not have any relevance, but the Windows is using corporation's transparent proxy.
How can I troubleshoot the situation step by step?
Update:
I don't have firewall installed --
% iptables -L
-bash: iptables: command not found
% sudo iptables -L
sudo: iptables: command not found
% ufw status
-bash: ufw: command not found
% dpkg -l | grep fire || echo no firewall found
no firewall found
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux bullseye/sid
Release: testing
Codename: bullseye
I had the same situation. I deployed react service in the container in the centos 8. The host from which I was trying to access the service was windows. I was unable to access the service from my windows host browser. And stopping the firewall did the thing for me.
systemctl stop firewalld
systemctl restart docker

Error connecting to docker container

I installed a service on a remote Linux computer using docker. I used the following commands
git clone https://github.com/OpenVidu/openvidu-tutorials.git
npm install -g http-server
http-server openvidu-tutorials/openvidu-getaroom/web
docker run -p 4443:4443 --rm -e openvidu.secret=MY_SECRET -e openvidu.publicurl=https://187.84.228.66:4443 openvidu/openvidu-server-kms
But when I try do connect at the first time, I received the follow error menssage:
"ERR_EMPTY_RESPONSE", and sometime "ERR_CONNECTION_CLOSED"
I used the following diagnostic command in Linux computer “docker ps” and received the following response:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
21b0620266cd openvidu/openvidu-server-kms:latest "/usr/bin/supervisor 5 days ago >Up 5 days 8443/tcp, 8888/tcp, 0.0.0.0:4443->4443/tcp, 9091/tcp sick_ritchie
What is wrong? How can I solve this?
I'm not sure sure what causes this, but when I had the same problem (with different http server) I changed listening on particular ip address (which was 127.0.0.1 in my case) to listening on all interfaces - 0.0.0.0.
I mean http server configuration, not Docker configuration.

A Good Explanation of Remotely Debugging NodeJS on EC2

I've seen this post, but it's not quite clear to me.
If I want to debug my NodeJS app running on EC2 (ubuntu 12.04) from my laptop - how do I do it?
I'm running the following on EC2
nodemon --debug app.js
And I've got node-inspector installed on EC2.
When I run the ssh command, I get the following:
C:\>ssh -L 5858:127.0.0.1:5858 ubuntu#ubuntu-aws
The authenticity of host 'ubuntu-aws (XXX.XXX.XXX.XXX)' can't be established.
RSA key fingerprint is ...
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ubuntu-aws,XXX.XXX.XXX.XXX' (RSA) to the list of known hosts.
Permission denied (publickey).
First, is that right? I run ssh on my laptop? Then I run node-inspector on EC2? Then I'll be able to connect with Chrome Dev tools from laptop?
And how do I fix that ssh error?
you still have to include your pemfile, like in your example: ssh -i pemfile.key -L 5858:127.0.0.1:5858 ubuntu#ubuntuaws

MPJ Express -- runtime.MPJRuntimeException: Cannot connect to the daemon at machine <x> and port <10000>

i am facing problem while configuring MPJ Express in cluster mode.
i am following the guide given at
http://mpj-express.org/docs/guides/linuxguide.pdf
the environment variables are successfully Initialized as
1)
Set MPJ_HOME and PATH variables
a. export MPJ_HOME=/path/to/mpj/
b. export PATH=$PATH:$MPJ_HOME/bin
2)
the machines are also added successfully with a machines file as
mpjboot machines
it shows message
starting mpjd...
3)
Next step is to test the HelloWolrd program by
Compile:
javac -cp .:$MPJ_HOME/lib/mpj.jar HelloWorld.java
10. Execute: mpjrun.sh -np 2 –dev niodev HelloWorld
when i do that i get this error
runtime.MPJRuntimeException: Cannot connect to the daemon at machine and port <10000>
The Platform i am using is
Sun Ultra 25 workstations with Solaris 10 OS
i have made a Fast Ethernet cluster of 2 machines
ssh is enabled with root user on each machine
network is established well
any help or solution is appreciated..
thank you
Examine the cluster nodes environment variables.
Try adding vars to .bashrc in each cluster node (ssh to it from main node):
echo 'export MPJ_HOME=/home/<user>/path/to/mpj' >> ~/.bashrc
echo 'export PATH=$PATH:$MPJ_HOME/bin' >> ~/.bashrc
Alternately, turn on logging /conf/wrapper.conf, run and report your findings.
This is the first time i give an answer in stackOverflow.
I set up MPJExpress-v0_42 in my centos6.3 with jdk1.6.0_32, and finally everything seems OK.
Question 1: can not connect to daemon at machine and port
This may happens that the daemon is not running. You can give a try as follows:
you can use sudo netstat -anp |grep port to check whether the port is listening and also get the processId.
In my machine, after I started the daemon using mpjdaemon -boot localhost, I used the sudo netstat -apn |grep 4000 command to check the port and got the followings.
tcp 0 0 :::40000 :::* LISTEN 8766/java
tcp 0 0 :::40001 :::* LISTEN 8766/java
the port is configured in $MPJ_HOME/conf/wrap.conf and my configuration is as follows:
#port number for the daemon.
wrapper.app.parameter.2=40001
#Socket Server Port Number.
wrapper.app.parameter.3=40000
I also use the jps -m command to get the java daemon process, the result is as follows:
8766 MPJDaemon 40001
30850 Jps -m
Here 8766 is the processId as netstat shows, and MPJDaemon is the daemon process, 40001 is the listening port.
In your question, you cannot connect the daemon process. Do the followings:
you should check the port. If you cannot find the port using netstat, it generally means the MPJDaemon is not running.
To be sure, you can also using jps to check the process. Maybe process is running but the port is another one
Do not use the Cluster commands like mpjboot machines or mpjrun.sh -np 2 -dev niodev HelloWorld. You can use mpjdaemon -boot localhost to test current machine, if it is configured OK and you can set the machines file with one item of localhost and run Cluster commands.
Other questions that I met.
Question 2: compile failed using ant
At first I use MPJ-v0_44.zip and jdk1.6.0, but it cannot compile and give an error that ProcessBuilder has no method of "interNIO"(something like that). I analyse the source code and guess may be it is because JDK version is a litter lower. Given the fact that upgrading JDK is a litter complicated, I find another MPJ version of mpj-v0_42.zip and it compiled OK.
Question 3: mpjdaemon -boot localhost with no error message, but MPJDeamon is not running.
After I configure the environment variables like MPJ_HOME from .bash_profile to .bashrc, the question is resolved. I don't know why.
Question 4: command jps -m says "MPJDeamon is running" , but mpjdaemon -status localhost says "mpjdeamon is not running".
I use command (ssh localhost nohup 'jps -m') and it says jps command not found, but i use jps the command works fine. I guess maybe it is the same question as above. The jps's path is not configured in path environment variable of .bashrc. So after adding one line of PATH=/jpspath:$PATH in .bashrc, everything works fine.

Jmeter-server hanging on linux system

When I try and run jmeter-server from a server connected via putty, it hangs with:
bash-3.2$ ./jmeter-server -t filename.jmx
Using local port: 4000
Created remote object: UnicastServerRef [liveRef: [endpoint:[172.31.120.200:4000] (local),objID:[1a15acdf:12f949f58d8:-7fff, -8305458059461378367]]]
What am I doing wrong? It just hangs. Previously it was erroring with:
bash-3.2$ ./jmeter-server
Using local port: 4000
Created remote object: UnicastServerRef [liveRef: [endpoint:[172.31.120.200:4000](local),objID:[1fa5aea9:12f94a578a6:-7fff, -8358825329658872549]]]
Problem creating registry: java.rmi.server.ExportException: Port already in use: 1099; nested exception is:
java.net.BindException: Address already in use
Continuing...
Server failed to start: java.rmi.RemoteException: Cannot start. See server log file.
What gives?
Port 1099 is default port of jmeter server, this means that you have already lauched jmeter server. I think you should first kill it and then try to start:
ps ax | grep jmeter
kill -9 PID (from previous command)
Before starting remote testing I think you should read documentation, seems you are doing it wrong: http://jmeter.apache.org/usermanual/jmeter_distributed_testing_step_by_step.pdf
Looks you need change your jmeter SERVER_PORT to a not "1099" number from the error information.
Guess I probably were in your situation.
It helps to me to use java8 and the next properties when starting jmeter-server
/opt/jmeter/bin/jmeter-server \
-Dserver.rmi.localport=50000 \
-Dserver_port=1099 \
-Jserver.rmi.ssl.disable=true
Also check logs in jmeter-server.log file

Resources