How do I check if a port is open between two Linux servers? [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
How do you check if a port is open when you cannot use telnet or install Cacti? I want to see if a port is open between two Linux servers. Telnet isn't installed. I tried this command:
cat < /dev/tcp/x.x.x.x/6061
where x.x.x.x was the remote IP address of the Linux server and port 6061 is the port that I want to test. But based on tests of known working and not working ports, this command wasn't conclusive to me. There may be an environmental explanation for that.

Install nmap and than:
nmap x.x.x.x

Better use (if installed) : netcat :
nc -zw3 <host> <port>
If you want to use the bash feature net redirection :
cat < /dev/tcp/x.x.x.x/6061
do it the right way :
{ exec 3<> /dev/tcp/127.0.0.1/6061; } &>/dev/null &&
echo "Connection to socket OK" ||
echo >&2 "Can't connect"
If it doesn't work, you need to compile bash with --enable-net-redirections

Related

No remote commands executed when ssh runs as sudo [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
The following command gives the expected result (file is created):
sshpass -p pas ssh root#host 'touch foo'
But the following one does nothing on the remote host:
sudo sshpass -p pas ssh root#host 'touch foo'
The only difference here is just sudo mode.
What is the reason here? And how this can be solved?
The problem is more visible when running ssh -v.
With sudo communication interrupts after detecting the server host key.
To solve the problem ssh needs to run with the following argument -o "StrictHostKeyChecking no".

Why can not stop vsftpd server? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I am use Ubuntu Linux, and when I run command netstat -lt, then show:
tcp 0 0 *:ftp *:* LISTEN
then I run command sudo service vsftpd stop, and run command netstat -lt again, the terminal will not show ftp server, but after a while, I am run command netstat -lt again, the terminal will show ftp server again:
tcp 0 0 *:ftp *:* LISTEN
How strange it is!
How can I stop ftp server?
You may have another ftpd service.
Try with this:
# ps -ef | grep ftpd
And search for ftpd daemons.

Google Compute Engine - troubleshooting SSH default port [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
when running
gcutil ssh myproject_name
ssh run with the following command
ssh -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i /Users/MyUser/.ssh/google_compute_engine -A -p 22 MyUser#xxx.xxx.xxx.xxx
i've changed my ssh port to 1234 in sshd_config file and opened a firewall rule at my compute engine console. executing the following command works perfect and connection is established
ssh -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i /Users/MyUser/.ssh/google_compute_engine -A -p 1234 MyUser#xxx.xxx.xxx.xxx
but when running this command gcutil ssh myproject_name port 22 is being called.
How & where can i change the default port of ssh so I wont have to use the long command in order to connect to my instance
gcutil supports alternate ports via the --ssh_port flag. In your case, this should work:
gcutil ssh --ssh_port 1234 INSTANCE_NAME

combing multiple commands when using ssh and scp [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I am having multiple ssh commands to do some tasks for me. For eg:
ssh a-vm "rm -f /home/dir/file1.xlsx"
ssh a-vm "rm -f /home/dir/file2.xml"
scp me#b-vm:/somedir/file1.xlsx .
scp me#b-vm:/somedir/file2.xml .
1) Is there a way to combine 2 ssh commands into 1 and two scp commands into 1?
2) Is there a cost if I do ssh and scp multiple times instead of 1 time?
Any help is appreciated.
You can just do:
ssh a-vm "rm -f /home/dir/file1.xlsx ; rm -f /home/dir/file2.xml"
scp "me#b-vm:/somedir/{file1.xlsx,file2.xml}" .
Each ssh/scp call will cost you the connection time and some cpu time (could be significant if you do that to hundreds of machines at the same time, otherwise unlikely).
Alternatively you can use a persistent master connection for ssh and tunnel others over it. That will save a couple of network roundtrips - see http://en.wikibooks.org/wiki/OpenSSH/Cookbook/Multiplexing

Telnet File Transfer between two linux machines [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I want to send a file from one Linux machine with IP suppose "192.168.2.25" to other Linux machine that's a server "192.168.2.110"
how can i do that by using Telnet command??
A simple option is to use netcat (nc). This is particularly useful on stripped down Linux systems where services like ssh and ftp are turned off.
On destination machine run the following command: nc -l -p 1234 > out.file
On source machine run the following command: nc -w 3 <dest-ip-adr> 1234 < out.file
For more details look, for example, here.
There are also netcat implementations for Windows, e.g. ncat.
While it may not be possible with only telnet, it is possible with telnet and netcat. Some of the examples above just referenced using netcat, but there have been times when I was on an old machine that was still in production that had telnet but not netcat. In this case, you can set netcat to listen on a newer, remote machine and telnet the file to it.
On the newer remote machine:
netcat -l <PORT> > OUTPUT.FILE
On the older telnet only machine:
cat FILE | telnet REMOTE-HOST PORT
Note that this works with text files. If you have a binary file of some sort you would need to do further manipulation on both ends.
Telnet just gives you a remote terminal session. The best you could do is telnet, open a new file in an editor and copy/paste the text from the local machine.
To copy files use something like rsync, scp, rcp or ftp.

Resources