linux-ssh-端口更改-及-ip-限制-&-rsa-登录
原文见 cnblog: 修改linux的ssh默认端口号22的方法 rsa 参考 一、修改配置文件 vi /etc/ssh/sshd_config 找到#Port 22 修改为自己要使用的端口号:Port 26000 然后 :x 退出保存 二、重启ssh服务 /etc/init.d./sshd restart 如果还要设置防火墙,配置:vi /etc/sysconfig/iptables 启用26000端口:/etc/init.d/iptables restart 三、如果要显示固定IP才能登陆: 1.修改 /etc/hosts.deny, 加入一行sshd:ALL –#意思是任何ip都不能登陆 2.然后修改:/etc/hosts.allow,在其中进行如下设置:sshd:192.168.0.241:allow –#意思是只允许192.168.0.241登陆 四、rsa 密钥对登录 client 执行以下命令生成密钥对 (~/.ssh) ssh-keygen -t rsa 把 is_rsa.pub 复制到服务器的 ~/.ssh/authorized_keys 文件后面 配置 /etc/ssh/sshd_config RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys service sshd restart 20241220 新增 上述是 centos 更改 ssh 端口, 不适用 ubuntu 2204 以后的版本, ubuntu 最新版本 配置ssh端口如下 参考自 csdn: 【解决】Ubuntu SSH Server 修改默认端口无效
Recent Posts
Tags
- apache 4
- axios 1
- benchmark 1
- c 1
- canvas 1
- centos 3
- channel 1
- crontab 1
- css 2
- docker 4
- fail2ban 1
- frp 1
- gin 1
- github 1
- go 26
- goaccess 1
- goroutine 1
- http 1
- https 1
- jetbrains 1
- jquery 1
- js 2
- linux 20
- mermaid 1
- mysql 10
- nginx 3
- node 1
- php 43
- prisma 1
- react 8
- server 1
- ssh 2
- tarojs 1
- tcp/ip 1
- token 1
- ubuntu 1
- ufw 1
- unit-test 1
- vmware 1
- vscode 1
- vue 12
- yum 1
- 域名 3
- 安全 2
- 微信 3
- 算法 3