Skip to content Skip to sidebar Skip to footer

Allowing Root Access SSH Login Ubuntu 20.04

Root or Super User is the highest access right in Linux. Hello friends, welcome back to our Web Blog, namely Awonapa Discussing Server. On this occasion we will share about the Ubuntu Server Tutorial Series, which discusses Allowing Root Access SSH Login Ubuntu 20.04.

Allowing Root Access SSH Login Ubuntu 20.04

The previous discussion has discussed Installing Ubuntu Server 20.04 using VirtualBox. On this occasion we will discuss the IP Address Configuration on Ubuntu Server 20.04.

Guide Allowing Root Access SSH Login Ubuntu 20.04

Table Of Contents

  • Adapter Configuration in VirtualBox Ubuntu Server 20.04
  • Run Ubuntu Server 20.04 Virtual Machine
  • How to Configure IP Address Ubuntu Server 20.04
  • Windows IP Address Configuration Process
  • Install and Configure Ubuntu SSH Server
  • How to Change SSH Port of Ubuntu 20.04 Server
  • Allowing Root Access SSH Login Ubuntu 20.04

1. Adapter Configuration in VirtualBox Ubuntu Server 20.04

The previous discussion has discussed Installing Ubuntu Server 20.04 using VirtualBox. On this occasion we will discuss the IP Address Configuration on Ubuntu Server 20.04.

Create 2 adapters on the virtual machine:

  • Adapter Bridge (connect to wifi or lan connected to the internet)
  • Host Only Adapter (To connect to Host and Guest)
  1. Stage 1 : Click on the ubuntu server 20.04 virtual machine, then click network on the virtualbox.

    Configure Network VirtualBox
     
  2. Stage 2 : In Adapter 1 we will create a bridge adapter that is used for internet sources on the Ubuntu Server. Here I use a LAN cable. Alternatively you can use WIFI or Wireless.

    Brige Adapter : LAN

  3. Stage 3 : In Adapter 1 we will create a Host Only Adapter which is used for communication sources between guest and host or server and client.

Adapter 2 : Host Only Adapter

2. Run Ubuntu Server 20.04 Virtual Machine

After setting up the network adapter, next run the virtual machine, as shown below:

Finish Create Virtual Machine Ubuntu

3. How to Configure IP Address Ubuntu Server 20.04

  • Please login using root / super user.
  • Then configure the IP address using the command:

  • IP Address bridge: DHCP CLIENT
  • IP Address Host Only: 192.168.111.1/24
nano /etc/network/interfaces

Then equate the configuration as shown below:

Configuration IP Address

Description:

  • On enp0s3 using DHCP Client
  • On enp0s8 using Static IP Address
# configuration ip address internet eth1 (bridge)
# dhcp
auto enp0s3
iface enp0s3 inet dhcp


# configuration eth2 atau enp0s8 (host only adapter)
# static
auto enp0s8
iface enp0s8 inet static
address 192.168.111.1
netmask 255.255.255.0
network 192.168.111.0
broadcast 192.168.111.254

Next, please save by CTRL+X then Y and ENTER.

To restart the ip address configuration results can use the command :

systemctl restart networking 

or if you want to use other commands, you can install tools with the command : (make sure you are connected to the internet)

apt install ifupdown net-tools

If you have finished and successfully installed the tools, then friends can restart the network with another command, namely :

/etc/init.d/networking restart 

Restart Network

Then check the configuration results using the : ifconfig

Check Configuration IP Address

4. Windows IP Address Configuration Process

If you have finished configuring the IP Address on the Ubuntu Server, the next step is to configure the IP Address in Windows on the Host Only Adapter. Friends can follow the following steps:

open the network and sharing center, or simply: Windows + R, then type ncpa.cpl dan enter.

Configuration IP address Host Only

Result Configuration IP address Host Only

Please do testing on the Host and Server do the ping process between devices as shown below:

ping from windows to server
ping from windows to server

5. How to Install and Configure Ubuntu SSH Server

  • For the ssh server installation process on Linux Ubuntu 20.04, you can use the command:
apt-get install openssh-server
  • Make sure your server is connected to the internet.

Install SSH Server

  • If you notice, when we run the openssh-server command, some packages follow the install as well, openssh-client and openssh-sftp-server.
  • Next, if you have finished installing openssh-server, friends can see the status of the ssh server using the command:
/etc/init.d/ssh client 

cek status ssh server

  • Testing SSH Server on Host / Windows.
  • If so, we will do SSH Connection, using the PuTTY application, friends can download it on the official website, https://www.putty.org/
  • Enter the Server's IP Address

Remote SSH with IP

  • If so, then click Accept on Putty

Accept Putty

  • Here we will log in using the user we created at the beginning of the install.

remote ssh login user with putty

  • And here we have successfully logged in, and friends can also log in using the super user with the command:
  • sudo su

Login Super User

6. How to Change SSH Port of Ubuntu 20.04 Server

A Server Administrator is instructed to change the port on the SSH Server from the default port 22 to port 2023.

  • First make sure you have SSH Server running on Linux Ubuntu
  • We will go into the /etc/ssh folder using the command
cd /etc/ssh
  • There are several files in the folder, then we will configure the sshd_config file in the /etc/ssh folder.

    file sshd_config on ssh

  • Open the sshd_config file in the /etc/ssh folder
nano sshd_config
  • Please search for #Port 22, and there we will change it to Port 2023, remove the #.

    Port Default SSH
  • Be like the following:

    Change port to 2023
    Save file.
  • Then we will change a little in /etc/services, find ssh in the file, then change port 22/tcp to 2023/tcp.
SSH            2023/TCP            # SSH Remote Login Protocol
  • If you have done a save on the ssh configuration, friends. And don't forget to restart using the command : 
/etc/init.d/ssh restart
  • Here we can see the changes by checking the status on the ssh server with the command :
/etc/init.d/ssh status
result change port ssh

The process for port changes is complete. So how was the test?

  • If you use cmd, you can remote ssh using the following command : 
ssh -p 2023 nameuser@ipserver

  • If based on the server above, the command is as follows :
ssh -p 2023 wahyup@192.168.111.1

Test SSH Server

  • For testing using Putty, friends only need to change the port from 22 to 2023 in the port field in Putty..

7. Allowing Root Access SSH Login Ubuntu 20.04

  • First make sure you have SSH Server running on Linux Ubuntu
  • We will go into the /etc/ssh folder using the command
cd /etc/ssh
  • There are several files in the folder, then we will configure the files sshd_config on folder /etc/ssh

    file sshd_config on ssh

  • open file sshd_config on folder /etc/ssh
nano sshd_config
  • Find a sentence #PermitRootLogin prohibit-password
    #PermitRootLogin prohibit-password
    Search PermitRootLogin prohibit-password

  • change to PermitRootLogin yes
    PermitRootLogin yes
    PermitRootLogin yes

  • If you have done a save on the configuration then restart the ssh server
/etc/init.d/ssh restart
  • By default the root password is not set in ubuntu 20.04 and the error message permission denied, please try again will appear when trying to ssh login as the root user. 
  • Here we need to set the root password. Here is how:
  • sudo passwd
    Passwd Re-Initialization

  •  After that, test the client with the ssh command as follows:
ssh -p 2023 root@192.168.111.1
  • The following are the results of the ubuntu server ssh root login on the windows client using cmd
    SSH Root Access Successful

Successful SSHP Root Access In the above command we use the results of the previous configuration, which changes the port from 22 to 2023. If you do not change the port then the ssh command does not need to use -p 2023.

only = ssh root@192.168.111.1

Conclusion

The root access process can make it easier for users to configure the server. In addition, for security, you can use Public Key, we will discuss it later :)

Well friends, that's it for the Linux Ubuntu Server 20.04 Tutorial, which discusses How to Change SSH Port of Ubuntu 20.04 Server. God willing, this Linux Ubuntu Server 20.04 Tutorial Series List will be updated again according to the article posted about the Linux Ubuntu Server 20.04 Tutorial. Hopefully this tutorial is useful for all of us.

That's all and Thank you

Tag Penelusuran
  • Tutorial Ubuntu Server 20.04
  • Ceflox
  • Configuration IP Address Ubuntu
  • IP Address Ubuntu
  • SSH Server
  • Root Access SSH

Post a Comment for "Allowing Root Access SSH Login Ubuntu 20.04"