Master Operator: Set up your Linux server – Change SSH Port, Configure DNS, Set Timezone

Congratulations! It seems you have got a new server, rookie!

Change SSH Port

vi /etc/ssh/sshd_config

Start a new line after #Port 22, then add:

Port 2002

(2002 above should be the port you want to use instead.)
Then save & quit (Esc, :wq)

SELinux Settings

Some systems have SELinux enabled, we could shut it down to prevent some further issues.

Edit /etc/selinux/config, find SELINUX=enforcing. Rewrite it as SELINUX=disabled

Also, you may want to shutdown SELinux before you reboot. Then execute command: setenforcein your shell.

Then save&quit.

Configure DNS

DNS servers are listed in /etc/resolv.conf
We can use something like this:

nameserver 1.1.1.1
nameserver 1.0.0.1

Timezone

In /usr/share/zoneinfo/ you can find directories corresponding to the continents. Under those directories, there are corresponding cities.
Run the command below to set time as Mountain Time:

cp /usr/share/zoneinfo/US/Mountain /etc/localtime

Of course in CentOS7 it is even easier, you can just run a command to call the program.

timedatectl set-timezone US/Mountain

Gaukas Wang

Enthusiastic!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *