The Network Time Protocol (NTP) is used to synchronize the time of a computer client or server to another server. To install ntp on Ubuntu 19.04 using commands below:
root@thehackertips:~# apt -y install ntp
To configure ntp server you needs to open configuration file /etc/ntp.conf. Make sure You comment out default ntp servers.
# 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
If you have firewall enabled You may add ntp to firewall allow list and restart the firewall service.
root@thehackertips:~# firewall-cmd --add-service=ntp --permanent
root@thehackertips:~# firewall-cmd --reload
You can test ntp service ntpq -p commands.
To start, stop, restart and to look at ntp service status You can run commands as follow:
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
Configure SSH Server
SSH is installed on Ubuntu 19.04 by default, however it is need to be configured for security reason. IF it is not installed any reason You can install that with this commands:
root@thehackertips:~# apt -y install openssh-server
root@thehackertips:~# systemctl start ssh
To make some configuration on SSH you need to edit configuration file: /etc/ssh/sshd_config .
There are some main configuration on SSH which you need to follow: disable SSH access for root user, change ssh default port and allow ssh access only for required users. To do that you need to open configuration file and add those lines as below:
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
To connect to another SSH server you need to type ssh and IP address of the remote host:
root@thehackertips:~# ssh 172.16.171.226
On windows client you can use Putty to connect to ubuntu server with SSH: