When mapping a network drive in the windows system, how to remotely access the Samba service of the Linux server through a port other than 455

statement

  • Normally, when using the Samba service of the Linux server to map the network drive in Windows, the general default is to directly fill in the ip of the Linux server on the internal network, and it will default to port 445.
  • What should I do if my windows is not on the same network segment as the Linux server?

1 Open CMD with an administrator account to check the occupation of port 445

netstat -ano | findstr 445

insert image description here
It is the process with pid 4 to monitor.

2 Disable the server service

Right-click Computer – Manage – Services and Applications – Services, find the service named Server, double-click to open the properties, and change the startup type to Disabled.
insert image description here
insert image description here

3 Restart the computer and check the 455 port occupation again

netstat -ano | findstr 445

Shown as unoccupied.

4 Modify port forwarding

netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=445 connectaddress=$(smb服务器的IP地址或绑定的域名) connectport=$(smb服务器的端口号)

5 Check if the port forwarding is successful

netsh interface portproxy show all

It can be displayed as follows:
insert image description here

6 Mapping a network drive

When mapping the network drive, fill in 127.0.0.1 to map to the Samba service of the Linux server.
insert image description here

7 Complete the mapping

The network drive mapped in windows is as follows:

insert image description here

Guess you like

Origin blog.csdn.net/Xiaoma_Pedro/article/details/131419839