概述
一、检测和安装sshd服务
1、检测是否安装
[root@localhost ~]#rpm -qa | grep opensshd
(1)未安装(几乎所有机器都是安装了的)
[root@localhost ~]# rpm -qa |grep opensshd
[root@localhost ~]#
(2)进行选择安装
[root@localhost ~]# find /mnt/cdrom/Packages -name “openssh*”
/mnt/cdrom/Packages/openssh-6.6.1p1-22.el7.i686.rpm
/mnt/cdrom/Packages/openssh-askpass-6.6.1p1-22.el7.i686.rpm
/mnt/cdrom/Packages/openssh-clients-6.6.1p1-22.el7.i686.rpm
/mnt/cdrom/Packages/openssh-keycat-6.6.1p1-22.el7.i686.rpm
/mnt/cdrom/Packages/openssh-server-6.6.1p1-22.el7.i686.rpm
[root@localhost ~]# rpm -ivh [你要安装的包]
(3)已安装
2、本地相关设置
(1)启动服务
[root@localhost ~]# service openssh start
Redirecting to /bin/systemctl start openssh.service
Failed to start openssh.service: Unit openssh.service failed to load: No such file or directory.
[root@localhost ~]# systemctl start ssh.service
Failed to start ssh.service: Unit ssh.service failed to load: No such file or directory.
(2)进行本地设置
[root@localhost ~]# ssh 127.0.0.1
root@127.0.0.1’s password:
Last login: Thu May 5 06:33:51 2016 from 10.11.24.18
[root@localhost ~]#
二、配置相关服务
1、密钥产生
[root@localhost ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): SSH_MY
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in SSH_MY.
Your public key has been saved in SSH_MY.pub.
The key fingerprint is:
…………………………..
…………………………..
…………………………..
2、公钥分配
# scp SSH_MY.pub root@[目标机ip]:~/.ssh
3、连接目标机
[root@localhost .ssh]# ssh root@[目标机ip]
4、改写目标机的authorized_keys文件(追加在其后)
[root@localhost .ssh]# cat SSH_MY.pub >> authorized_keys
5、退出目标机
[root@localhost .ssh]# logout
6、登录目标机
[root@localhost .ssh]# ssh -i SSH_MY root@[目标机ip]
最后
以上就是体贴板栗为你收集整理的centos 7 红帽认证 sshd服务搭建的全部内容,希望文章能够帮你解决centos 7 红帽认证 sshd服务搭建所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复