怎么在linux里面修改端口号

怎么在linux里面修改端口号,第1张

Linux下修改端口号只需要更改相应服务的配置文件即可,下面以修改linux 的SSH服务的默认端口号22为例(把22修改我2501):

1、修改/etc/ssh/sshd_config配置文件

[root@localhost ssh]# more sshd_config 

#       $OpenBSD: sshd_config,v 1.69 2004/05/23 23:59:53 dtucker Exp $

# This is the sshd server system-wide configuration file.  See

# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with

# OpenSSH is to specify options with their default value where

# possible, but leave them commented.  Uncommented options change a

# default value.

#Port 22             //先把22注释掉

port 2501            //添加一个新的端口

#Protocol 2,1

2、重启ssh服务让修改的端口号生效

[root@localhost ~]# service sshd restart

Stopping sshd:[  OK  ]

Starting sshd:[  OK  ]

1。查看数据库实例名:命令1:db2 get dbm cfg在列出的内容中查找TCP/IP Service name (SVCENAME) =  项的值,本例为DB2_inst64.命令2:直接查找到数据库实例名,db2 get dbm cfg | grep -i service 也可以查找到数据库实例名。

2。查看端口号:通过上一句命令的输出(如DB2_inst64)在/etc/services文件中找对应的端口号

grep DB2_inst64 /etc/services

3。修改端口号:命令修改:db2  update   dbm   cfg using   svcename <端口号或者服务名>

1。Linux是一套免费使用和自由传播的类Unix *** 作系统,是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的 *** 作系统。它能运行主要的UNIX工具软件、应用程序和网络协议。它支持32位和64位硬件。Linux继承了Unix以网络为核心的设计思想,是一个性能稳定的多用户网络 *** 作系统。

2。Linux *** 作系统诞生于1991 年10 月5 日(这是第一次正式向外公布时间)。Linux存在着许多不同的Linux版本,但它们都使用了Linux内核。Linux可安装在各种计算机硬件设备中,比如手机、平板电脑、路由器、视频游戏控制台、台式计算机、大型机和超级计算机。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/9023504.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-24
下一篇2023-04-24

发表评论

登录后才能评论

评论列表(0条)

    保存