系统信息
系统:Centos 7
SSH客户端和服务端安装
# 安装客户端和服务端
yum install openssh-clients -y # 安装ssh客户端程序
yum install openssh-server -y # 安装ssh服务端程序
# 服务管理(ubuntu 18)
systemctl enable sshd # 开机启动
systemctl restart sshd # 重启服务
systemctl status sshd # 插卡服务信息
systemctl stop sshd # 停止服务
systemctl start sshd # 启动服务
# 服务挂你(老机器)
service ssh start 或者 /etc/init.d/ssh start # 开启ssh服务
service ssh stop 或者 /etc/init.d/ssh stop # 关闭ssh服务
ps -e | grep ssh # 查看ssh服务是否开启
netstat -lntp # 查看ssh服务端口
修改配置文件
# 配置文件:
vim /etc/ssh/sshd_config
# 修改内容
Port 2222 (配置服务端口)
#PermitRootLogin prohibit-password (禁止密码登录)
PermitRootLogin yes (启用密码登录)