mc-node.net →

How do I install 2FA on my VPS?

🖥️ VPS · Updated 05/03/2025
This tutorial is intended for experienced users of Linux systems!The credentials (IP address and root password) can be found in the email you received after ordering the VPS.
  1. Log in to the SSH of your VPS (This does not work with Windows VPSes, only with Ubuntu and CentOS VPSes.)
You can find the instructions for this here.
  1. Install the Google Authenticator package.
sudo apt install libpam-google-authenticator
  1. Install the Google Authenticator App on your phone
  2. Configure Google PAM in Ubuntu. Do this as follows.
    • Run the following command to open the correct file
sudo nano /etc/pam.d/common-auth
  • Add this line as shown in the screenshot.
auth required pam_google_authenticator.so

How do I install 2FA on my VPS?

  • Close the file by pressing Ctrl + x -> y -> enter.
  1. Run the command
google-authenticator

and follow the steps.

With this article you should have been able to set up 2FA on your VPS/dedicated server. If it still didn't work, our staff is ready to help you: Contact us