Difference between revisions of "Creating And Configuring A Remote Server"

From Nick's Personal Wiki
Jump to navigation Jump to search
Line 45: Line 45:
  
 
The terminal may not update right away, and you may need to log out and back in to see the changes reflected.  
 
The terminal may not update right away, and you may need to log out and back in to see the changes reflected.  
<nowiki>hostname</nowiki> can be used to see the currently configured hostname without logging out and back in.
+
 
 +
You can also use the 'hostname' command to see the currently configured hostname without logging out and back in.
 +
<nowiki>hostname</nowiki>
  
 
== Creating Non-Root Users ==
 
== Creating Non-Root Users ==

Revision as of 05:39, 19 December 2023

Connecting To A Created Server

Using SSH

Connect to the server via SSH using the below standard format, port number (if available), and the root credentials that were created when the server was created (if available):

ssh root@A.B.C.D:E

Where A.B.C.D is the IPv4 address of your server and E is the port number (if available).

Perform Any Available System Updates

There are likely several updates that need to be performed to bring the system up to date upon creation, use the below:

Ubuntu/Debian

apt update && upgrade

CentOS/RHEL/Fedora

 dnf upgrade


Setting Timezone

New servers are set to UTC by default, use the below to change the timezone to local time if desired.

List the available timezones:

timedatectl list-timezones

Set the desired timezone:

timedatectl set-timezone 'TIMEZONE_NAME_FROM_LIST'

Verify timezone has been set:

 date 


Custom Hostname

Setting a hostname can be done using the below:

hostnamectl set-hostname CUSTOM_HOSTNAME

Try to create something specific, relevant, and memorable.

i.e.

web-01-prod

wiki-01-staging


The terminal may not update right away, and you may need to log out and back in to see the changes reflected.

You can also use the 'hostname' command to see the currently configured hostname without logging out and back in.

hostname

Creating Non-Root Users

It's not advisable to use the unlimited access of the root account at all times, and the root account should not be permitted to access the server remotely. Create a limited-user account for the day-to-day tasks that will be performed instead using the below:

Ubuntu/Debian

Create the user:

adduser EXAMPLE_USERNAME

Grant the user sudo privileges:

adduser EXAMPLE_USERNAME sudo

CentOS/RHEL/Fedora

Create the user and set a password for that user:

useradd EXAMPLE_USER && passwd EXAMPLE_USER

Grant the user sudo privileges:

usermod -aG wheel EXAMPLE_USER

Logging In As The New User

Use the exit command to log out of the server, and repeat the steps from 'Connecting To A Created Server' using the credentials for the new user:

ssh EXAMPLE_USER@A.B.C.D:E 

Followed by entering the password set for this user.