How to listen all network interfaces for sshd? - server

I want sshd to listen all networks interfaces, but the sshd only listen one of network interfaces.
The sshd settings in ubuntu 20.04:
$ sudo sshd -T
port 22
addressfamily any
listenaddress [::]:22
listenaddress 0.0.0.0:22
......
Above phenomenon happens in my computers if a newer OS is installed, such as ubuntu 20.x, ubuntu 22.x or Debian 11. The phenomenon does not happen if a very old OS is installed, such as ubuntu 14.04. The sshd can listen all network interfaces if ubuntu 14.04 is installing.
I guess that the sshd makes this problem because other softwares can listen all network interfaces very well, and the all computer's IPs are able to ping from other computers.
How to listen all network interfaces for sshd?
I did try to install a fresh OS to use all defaults, then to modify "listenaddress 0.0.0.0:22" in /etc/ssh/sshd_conf, but no lucks.

Related

WSL2 Ubuntu cannot ping local ip

I need to find out why I'm not able to ping my local IP for my main computer from my ubuntu wsl terminal. For some reason, the WSL ip is 172.24.61.1/20. I have a postgresql server on 192.168.1.247 my main pc but it cannot even ping it. Anyone know why?
Firewall!
Turn off the firewall in windows and check the ping. Once it starts pinging add a rule for incoming and outgoing.
To turn off firewall in linux just use
systemctl stop firewalld
that is if you have firewall installed there, check it by using
systemctl status firewalld

WSL-2: Connect from Windows host machine to Ubuntu guest running PostgreSQL

I'm running PostgreSQL 10 on a Windows 10 WSL-2 installation of Ubuntu 18.04. I can start the service, connect to it locally from within Ubuntu with psql, and use it for local development. So far, so good!
I'd like to be able to connect to this instance from the host Windows OS, but can't connect. From Windows cmd, I've tried using telnet to see if I can connect to the NAT IP of the Ubuntu machine:
$ telnet 172.123.456.789 5432
Connecting To 172.31.175.251...Could not open connection to the host, on port 5432: Connect failed
When I run Django's runserver on port 8000, however, I can connect:
$ telnet 172.123.456.789 8000
[connected, returns HTML]
I've tried checking to see if it was something in Ubuntu's firewall ufw, but it isn't running:
$ sudo ufw status verbose
Status: inactive
Has anyone cracked this nut?

implication of using ufw for azure cloud Ubuntu VM, port opened is not working as expected

I have a cloud Ubuntu VM which is in some resource group of company's subscription.
I do not have access to azure portal.
I had opened up the ports whichever relevant in azure portal while choosing Virutal Machine. Now I need some more ports to gets opened up, wherein I have hurdles and complications regards to that.
Command ip address gives following ip for eth0 as it is default configuration.
inet 10.0.0.4/24
Wherein some dynamic ip assigned to this host 13.71.17.175 by azure, using which we access services whichever we run. I do not know how this routing happens. Now I need to open up few more ports, and I do not have access to azure portal.
I observed uncomplicated firewall,- ufw enablement works but leads to complication, as it overrides firewall configurations, I need to completely port all firewall configurations including ssh port,- 22 provisioning.
So sudo ufw enable is very dangerous on azure cloud Linux variant VMs. On the same pact we should do sudo ufw disable, else it is lockout situation if ssh port not provisioned by ufw. Once in fact I had requested my Senior Folk and ran the command sudo ufw disable through some Azure Virtual Machine Serial Console for the UbuntuVM
Now my question is basically,
sudo ufw allow from any to any port 18081 proto tcp
is not working.
After it is done, as per my observation, I am not able to access http:\\13.71.17.175:18081\
What ufw command I have to run in order to bridge 10.0.0.4 with dynamic ip assigned to host in azure portal,- 13.71.17.175
Service runs on 0.0.0.0:18081 and it is nexus service
$ netstat -tuplen|grep 18081
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:18081 0.0.0.0:* LISTEN 0 114209 -
From my machine, somehow test-netconnection 13.71.17.175 -p 18081 succeeded in powershell. But I do not know why http:\\13.71.17.175:18081\ didn't turn up.
And one more important thing, even restart of UbuntuVM in azure portal didn't turn off ufw.
Once this port is up & running, I have to port all firewall configuration to uncomplicated firewall,- ufw, that's how I could succeed with my config. and I do not have any other choice.
Now I had configured all the ports and enable ufw, but it looks like it requires restart. And I didn't do any bridging or routing to any other ip, rather opened up the ports in the present system. In order to enable ufw, system restart is required.
$ sudo ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
I had opened all the required ports say,
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw allow from any to any port 3306
sudo ufw allow from any to any port 18081
sudo ufw allow from any to any port 15672
sudo ufw allow from any to any port 8081
sudo ufw allow from any to any port 5672
sudo ufw allow from any to any port 5671
Here if ssh is not provisioned, then I have to go back to Azure portal to disable ufw :(

vsftpd installation on ubuntu 16.04 LTS

I'm use Linux server with vsftpd connection created successfully but i can't retrieve the files
Your screenshot shows that the connection timed out when trying to transfer something (LIST) after switching to Passive Mode (PASV). In my opinion, probably your firewall is not correctly configured for Passive Mode and therefore is blocking the connection.
Try allowing incoming (inbound) connections on port 40000 to 50000 for all IP address or the IP address of your FTP client. Configuring firewall is firewall-specific, therefore, I cannot give you detailed instruction on how to do this.
sudo ufw allow 40000:50000/tcp
sudo service vsftpd restart

Open TCP ports on Raspbian

I am trying to use my raspberry pi as a server, I have a java app using tcp port 1777 and mysql on 3306, however neither one or the other is accessible from lan (both works fine from the pi itself). When I scan the ports open on the pi from my laptop I only see the ssh and vnc ports, but when running the netstat on the pi both ports appear to be in listening state. I am running the latest version of raspbian (image had a ssh and vnc disabled by default, I enabled it in pi configuration (raspi-config)). Any ideas?
In my opinion, check which interface these services are listening on because the services listening on localhost are not 'binded' to the external network so try to make them listening on 192.**** ip address.
Example : Edit MySQL configuration
By default, MySQL is not configured to accept remote connections. You can enable remote connections by modifying the configuration file:
sudo nano /etc/mysql/my.cnf
and set bind-address = 192.** or bind-address = 0.0.0.0 then restart mysql servic:
sudo service mysql restart