GNU/Linux >> Linux の 問題 >  >> Linux

Centos 7 :NTP サーバーの構成

ネットワーク タイム プロトコル (NTP) は、コンピューター クライアントまたはサーバーの時刻を別のサーバーに同期するために使用されます。以下のコマンドを使用して、centos 7 に ntp をインストールするには:

[root@thehackertips ~]# yum -y install ntp

ntp サーバーを構成するには、構成ファイル /etc/ntp.conf を開く必要があります .

# Hosts on local network are less restricted.
restrict 172.16.171.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).

# add your ntp server here
server 0.az.pool.ntp.org

#broadcast 192.168.1.255 autokey # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 autokey # multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 autokey # manycast client

ファイアウォールが有効になっている場合 ntp をファイアウォール許可リストに追加し、ファイアウォール サービスを再起動することができます。

[root@thehackertips ~]# firewall-cmd --add-service=ntp --permanent
[root@thehackertips ~]# firewall-cmd --reload

ntp サービスをテストできます ntpq -p コマンド。

開始、停止、再起動、および ntp サービスのステータスを確認するには、次のようにコマンドを実行できます:

[root@thehackertips ~]# systemctl status ntpd
ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
Active: active (running) since Mon 2019-10-21 07:01:13 EDT; 1 day 1h ago
Process: 592 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status =0/SUCCESS)
Main PID: 603 (ntpd)
CGroup: /system.slice/ntpd.service
ââ603 /usr/sbin/ntpd -u ntp:ntp -g
ââ604 /usr/sbin/ntpd -u ntp:ntp -g

[root@thehackertips ~]# systemctl stop ntpd
[root@thehackertips ~]# systemctl start ntpd
[root@thehackertips ~]# systemctl restart ntpd

SSH サーバーの構成

SSH はデフォルトで Centos 7 にインストールされていますが、セキュリティ上の理由から設定する必要があります。何らかの理由でインストールされていない場合は、次のコマンドでインストールできます:

[root@thehackertips ~]# yum -y install openssh-server openssh-clients
[root@thehackertips ~]# service sshd start

SSH で設定を行うには、設定ファイル /etc/ssh/sshd_config を編集する必要があります。

従わなければならない SSH の主な構成がいくつかあります。root ユーザーの SSH アクセスを無効にし、ssh のデフォルト ポートを変更し、必要なユーザーのみに ssh アクセスを許可します。そのためには、構成ファイルを開いて、以下の行を追加する必要があります:

[root@thehackertips ~]# vi /etc/ssh/sshd_config
# Add or configure these lines
Port 1234 # for example 1234
PermitRootLogin no # change Yes to No
AllowUsers user1, user2 # user1 and user2 are the ssh allowed users

別の SSH サーバーに接続するには、リモート ホストの ssh と IP アドレスを入力する必要があります:

[root@thehackertips ~]# ssh 172.16.171.201
The authenticity of host '172.16.171.201 (172.16.171.201)' can't be established.
ECDSA key fingerprint is ee:3e:9b:e2:9f:3c:b9:cb:33:c6:70:6f:95:c5:9d:ce.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.16.171.201' (ECDSA) to the list of known hosts.
[email protected]'s password:

Windows クライアントでは、Putty を使用して SSH で Centos 7 に接続できます:


Linux
  1. CentOSで時刻同期のためにNTPをインストールして設定する方法は?

  2. CentOSでNTPサーバーをセットアップする方法は?

  3. CentOS / RHEL 7 で NTP サーバーとクライアントを構成する方法

  1. CentOS8にChronyNTPサーバーをインストールする方法

  2. CentOSでMariaDBサーバーを構成する

  3. CentOS / RHEL :DHCP サーバーの構成方法

  1. RHEL 8 / CentOS8LinuxでNTPサーバーを構成する方法

  2. Centos 7 :インストール、構成、管理

  3. Centos 7 :DNS サーバーの構成