Master DevOps: 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:



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

Join the ConversationLeave a reply

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




This site uses Akismet to reduce spam. Learn how your comment data is processed.