ntp+freeipa+ssh服務配置

實驗環境:workstation機器作爲服務端,實現ntp服務

          server1、server2、database作爲客戶端

實驗要求:完成時間的同步

          服務端訪問客戶端時,不需要密碼,且不準root用戶登陸

          利用iPA服務實現用戶管理

開始配置:

    一:configure ntp service

    1.使workstation機器作爲服務端。獲取asia的同步時間。

    vim /etc/ntpd.conf

#server 0.centos.pool.ntp.orgiburst

#server 1.centos.pool.ntp.orgiburst

#server 2.centos.pool.ntp.orgiburst

#server 3.centos.pool.ntp.orgiburst

server asia.pool.ntp.org ibursh

restrict 192.168.96.0 mask255.255.255.0 nomodify notrap

systemctl restart ntpd

systemctl enable ntpd

2.配置客戶端機器的時間

vim /etc/ntpd.conf

server 192.168.96.100 ibursh

systemctl restart ntpd

systemctl enable ntpd

使用date或者timedatectl查看

實現時間的一致性。

二:configure freeipa service

1.配置服務端的iPA服務

    yum -y installipa-server ipa-server-dns bind bind-dyndb-ldap

    做域名解析

    vim /etc/hosts

    192.168.96.100 workstation.example.com

    ipa-server-install --setup-dns

    #配置中包含認證、網頁服務的配置、用戶管理、身份驗證等

    kinit admin

    kinit list

    ipa user-add ruiyung --first=Yun --last=Rui –password

    ipa user-findruiyung

    ipa dnsrecord-add example.com server1 --a-rec192.168.96.101

    ipa dnsrecord-add example.com server1 --a-rec192.168.96.102

    ipa dnsrecord-add example.com server1 --a-rec192.168.96.103

    2.配置客戶端

    yum -y install ipa-client

    更該域名解析的DNS爲服務端

    nmcli c modifyeno16777736 ipv4.dns 192.168.96.100

    ipa-client-install

    authconfig --enablemkhomedir --update

    切換到admin用戶,就可以進行訪問,且含有家目錄

    三:configure ssh service

    1.服務端生成無密碼訪問

    ssh-keygen

    將生成的id轉發到客戶端,使彼此可以認識

    ssh-copy-id -iserver1.example.com

    ssh-copy-id -iserver2.example.com

    ssh-copy-id -idatabase.example.com

    嘗試遠程連接客戶端

    2.客戶端配置禁止root用戶登陸

    vim /etc/ssh/sshd_config

    PermitRootLogin no

    重新啓動服務sshd,即可生效。


    最後,基本完成三個服務的配置

    

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章