A very common aspect after getting a dedicated or virtual server provisioned, is to change hostname for many good reasons including publishing it worldwide as a pretty name for internet as well to keep reminding a machine by its assigned name instead of IPs.
Also it is important to change the password of your server once you got it from your provider to make it secure for you.
There are few steps which will let you know how you can perform both jobs quite easily in Linux Ubuntu.
Change Hostname
First of all you need to get ssh access as root
Below Simple command will let you know what is your current hostname as well as the Virtualization Type whether it is KVM or OpenVZ7 etc.
# hostnamectl
Next you will insert below command to edit / change your hostname
# sudo hostnamectl set-hostname my.hostname.com
You can replace “my.hostname.com” with whatever you want to update your own hostname.
Change root Password
If you are not login as root user, you can use below command to change password, enter your password twice for confirmation.
# sudo passwd root
If you are already login to ssh as root user or converted to root, you can achieve password changing goal by simply inserting below command.
# passwd
Leave a Reply