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

Ubuntu 19.04 :NTP サーバーの構成

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

root@thehackertips:~# apt -y install ntp

ntp サーバーを構成するには、構成ファイル /etc/ntp.conf を開く必要があります。デフォルトの ntp サーバーをコメントアウトしていることを確認してください。

# Specify one or more NTP servers.
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
# pool 0.ubuntu.pool.ntp.org iburst
# pool 1.ubuntu.pool.ntp.org iburst
# pool 2.ubuntu.pool.ntp.org iburst
# pool 3.ubuntu.pool.ntp.org iburst


# Use Ubuntu's ntp server as a fallback.
#pool ntp.ubuntu.com
server 0.az.pool.ntp.org
# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details. The web page
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
restrict 172.16.171.0 mask 255.255.255.0 nomodify notrap
# Needed for adding pool entries
restrict source notrap nomodify noquery

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

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

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

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

root@thehackertips:~# systemctl status ntp
â ntp.service - Network Time Service
Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2019-11-04 07:55:32 EST; 3min 11s ago
Docs: man:ntpd(8)
Process: 8848 ExecStart=/usr/lib/ntp/ntp-systemd-wrapper (code=exited, status=0/SUCCESS)
Main PID: 8866 (ntpd)
Tasks: 2 (limit: 1096)
Memory: 1.0M
CGroup: /system.slice/ntp.service
ââ8866 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 110:117
----------------------------------------------------------
root@thehackertips:~# systemctl stop ntp
root@thehackertips:~# systemctl start ntp
root@thehackertips:~# systemctl restart ntp

SSH サーバーの構成

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

root@thehackertips:~# apt -y install openssh-server
root@thehackertips:~# systemctl start ssh

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.226

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


Linux
  1. UbuntuとLinuxMintでNTPサーバーをセットアップする方法

  2. UbuntuサーバーでNTPを使用して時刻を同期する方法は?

  3. Ubuntu 19.04 :vim を構成する

  1. Ubuntu20.04NTPサーバー

  2. Ubuntu20.04サーバーのインストール

  3. Ubuntu 18.04 で Counter Strike サーバーを構成する方法

  1. Debian 9 /Ubuntu16.04サーバーでHAProxyを設定する方法

  2. Ubuntu16.04でBaculaサーバーを構成する方法

  3. UbuntuでOSSECを構成する方法-パート2