Skip to content

Commit

Permalink
Credit to u/brentbrewer for suggesting this change
Browse files Browse the repository at this point in the history
  • Loading branch information
snori74 authored Oct 9, 2020
1 parent 230044e commit 23db74e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions 03.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ Once you've reconnected back:
* Use `less` to view the file `/var/log/auth.log`, where any use of `sudo` is logged
* You could "filter" this by typing: `grep "sudo" /var/log/auth.log`

If you wish to, you can now rename your server, which in Ubuntu is done by editing two files, and then rebooting:
If you wish to, you can now rename your server. Traditionally you would do this by editing two files, `/etc/hostname` and `/etc/hosts` and then rebooting - but the more modern, and recommended, way is to use the `hostnamectl` command; like this:

* Edit /etc/hostname using nano text editor, deleting the old name and setting up a new one:
`hostnamectl set-hostname mylittlecloudbox`

`sudo nano /etc/hostname`
* Then edit the /etc/hosts file, replacing the existing computer name with your new one:
No reboot is required.

`sudo nano /etc/hosts`
* Reboot the system for changes to take effect:
For a cloud server, you might find that the hostname changes after a reboot. To prevent this, edit `/etc/cloud/cloud.cfg` and change the "preserve_hostname" line to read:

`sudo reboot`
`preserve_hostname: true`

You might also consider changing the timezone your server uses. By default this is likely to be UTC (i.e. GMT) - which is pretty appropriate for a worldwide fleet of servers. You could also set it to the zone the server is in, or where you and your headquarters are. For a company this is a decision not to be taken lightly, but for now you can simply change as you please!

Expand Down

0 comments on commit 23db74e

Please sign in to comment.