Webvirtmgr配置SSH链接(解决centos7,TCP认证失败)


系统环境:CentOS Linux release 7.5.1804 (Core)nginx

虚拟化:libvirt 3.9.0 版本web


操做以前必须搞清楚:vim


一、 服务端 webvirtmgr 的管理用户是谁?bash

ps -ef|grep webvirtmgr      #官方通常建议是nginx服务器


二、 客户端 libvirt 的管理用户是谁?ssh

经过webvirtmgr管理界面上SSH登陆时所输入的用户名ide

如:webvirtmgrspa




一、 在webvirtmgr服务器(服务端)生成密钥unix

#建立nginx宿主目录rest

cd /home

mkdir nginx #由于nginx用户在建立的时候是设置的sbin/nologin 因此这里须要手动建立家目录

chown nginx.nginx nginx/

chmod 700 nginx/ -R


#切换到nginx用户下生成秘钥对

su - nginx -s /bin/bash

-bash-4.2$ ssh-keygen ---期间输入yes后直接回车,回车

-bash-4.2$ touch ~/.ssh/config && echo -e "StrictHostKeyChecking=no\nUserKnownHostsFile=/dev/null" >> ~/.ssh/config

-bash-4.2$ chmod 0600 ~/.ssh/config


二、 在kvm(受控端)服务器上配置webvirt用户

[root@kvm_10 home] useradd webvirtmgr

[root@kvm_10 home] echo "123456" | passwd --stdin webvirtmgr

[root@kvm_10 home] groupadd libvirt

[root@kvm_10 home] usermod -G libvirt -a webvirtmgr


三、 在webvirtmgr服务器(服务端)上,将ssh-key上传到kvm服务器上

su - nginx -s /bin/bash

-bash-4.2$ ssh-copy-id webvirtmgr@10.0.0.66


四、 在kvm(受控端)服务器上配置 libvirt ssh受权

vim /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla

[Remote libvirt SSH access]

Identity=unix-user:webvirtmgr

Action=org.libvirt.unix.manage

ResultAny=yes

ResultInactive=yes

ResultActive=yes


chown -R webvirtmgr.webvirtmgr /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla


#重启 libvirtd 服务

systemctl restart libvirtd


五、 webvirtmgr 控制台中添加主机

image.png

相关文章
相关标签/搜索