FreeBSD13.3 ; Initial setup (Vim , SSH , firewall, NTP server)

1. Vim Install

Install Vim, which you are familiar with as an editor, as follows

Install Vim, which you are familiar with as an editor, as follows

Create a new ".vimrc" to set up the environment for using Vim, and fill in the following information

2. SSH Connection Security Measures

2.1 SSH port changed, root user login disabled

Reflection of settings

2.2 Use public key authentication method
① Creating public and private key pairs --- logging in as a general user to create them
If you do not specify the destination and file name, id_rsa and will be created in /home/huong/.ssh/. On the way, enter the password for the key.

➁Save /home/huong/.ssh/id_rsa to an appropriate location on Windows using WinSCP, etc.

➂Edit SSH configuration file

④Connecting with TeraTerm

User name : Login User Name
Password :Password specified in the creation of a public/private key pair
Check the "Use RSA/DSA…." checkbox. and in the "Private key file" field, specify the "id_rsa" that you just saved in windows.

3. Firewall Settings

FreeBSD has the following firewalls
In this case, we will use ipfw to configure the firewall

3.1  Check if ipfw works

3.2 Add configuration to /etc/rc.conf to use ipfw

3.3  Create additional configuration script (/usr/local/etc/ipfw.rules)

Additional configuration script content ----- for now open the following service ports
ftp (20,21), ssh (22), smtp (25), dns (53) , http (80), ntp(123) , https(443) pop3(110), imap(143), mail-over(587) , Modified SSH(2244)

System Reboot

Show ipfw list

4. NTP Server Settings

4.1 Rewrite the referenced NTP server in /etc/ntp.conf. Add an appropriate server in Japan.

4.2 Added to /etc/rc.conf to automatically start ntp at startup

4.3 Correct time
If the time is too far off, the NTP daemon will stop working, so use the ntpdate command to correct the time before starting the NTP daemon.

4.4 Time synchronization confirmation

+Servers that pass the connection test and can be referenced at any time
– Servers off the reference list in clustering checks
* Servers declared to be in reference synchronization

Copied title and URL