Linux-SSH-安全外壳

来源:互联网 发布:python执行mysql语句 编辑:程序博客网 时间:2024/06/06 14:49

rpm -qa | grep ssh
查看 SSH安装包
yum install openssh
安装SSH
ps -ef | grep ssh
查看是否在运行
service sshd start
开启服务
ssh root@X.X.X.X
使用SSH协议以root用户登录某设备

配置文件

/etc/ssh/sshd_config

Port —监听的端口,默认22
ListenAddress — 监听的地址
Protocol —SSH版本配置
PermitRootLogin —是否允许Root登录,默认允许

安全秘钥的访问方式
秘钥存放在服务器上。
ssh-keygen 生成秘钥对

[root@Test ~]# ssh-keygen Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): ---指定存放秘钥的位置,有默认位置Created directory '/root/.ssh'.Enter passphrase (empty for no passphrase): ----输入秘钥对应的密码,可以不设置Enter same passphrase again: 

ssh-copy-id X.X.X.X 将公钥传送到指定设备上

PasswordAuthentication —配置验证方式,no为只能使用秘钥认证。

原创粉丝点击