Skip to content

AS213941 · Peering-20% on all VPS with code NVH20 · Delivered in 60 seconds

Linux VPSFrom 2,49 €/monthWindows VPSFrom 3,49 €/monthFiveM serverFrom 0,99 €/monthMinecraft serverFrom 1,99 €/month
VPS & Cloud

Ranges

Linux NVMe VPSRoot access, Debian, Ubuntu, Alma…Windows RDP VPSRemote desktop, licence includedDedicated serversIntel Xeon Gold, exclusive resourcesPterodactyl VPSGame panel preinstalled

Network and hosting

Anti-DDoSWeb hostingColocationIP transitVPN

Professionals

Reseller VPSReseller programme
Solutions

Bots and automation

AI agents VPSA server for your coding assistants and autonomous agentsOllama VPSYour private AI without a GPU, data in FranceTelegram bot VPSPython or Node.js, always reachableDiscord bot VPSMusic, moderation, tickets: no downtimen8n VPSWorkflows with no execution limitVPN VPSAn encrypted tunnel exiting in FranceWeb scraping VPSScheduled data collection, dedicated IP

Trading

Forex VPSYour robots manage positions overnightMetaTrader 4 VPSSeveral MT4 terminals on one machineMetaTrader 5 VPSForex, indices and stocks in MT5NinjaTrader VPSFutures and NinjaScript strategiesProp firm VPSChallenges and funded accounts, terminal always onlineAfrica trading VPSMetaTrader in Paris, from North or West AfricaRDP VPSWindows remote desktop, always onTrading bot VPSOpen-source crypto bots, protected API keys

Windows desktop

Windows 10 VPSFor software that requires Windows 10Windows 11 VPSA modern Windows desktop, reachable anywhereSEO VPSLarge-site crawls without tying up your PCStreaming VPSAn OBS studio streaming from the data centreWordPress VPSFast websites on NVMe disks
Marketplace

AI

OllamaLocal language models, with no external APIOpen WebUIA chat interface for your Ollama modelsAnythingLLMA private AI assistant for your documentsLangflowVisual editor for agents, RAG flows and AI APIsFlowiseBuild AI agents and chatbots visuallyQdrantVector database for RAG and semantic search

Trading

MetaTrader 5Official MT5 terminal, ready for your EAsMetaTrader 4Official MT4 terminal, ready for your EAsForex VPS pack (MT4 + MT5)MT4 and MT5 together, on a VPS tuned for tradingNinjaTrader 8NinjaTrader 8 with its prerequisitesFreqtradeOpen-source crypto trading bot, in simulation modeInteractive Brokers TWS / IB GatewayTWS or IB Gateway, official stable version

Bots and agents

Claude CodeAnthropic's coding agent, in your terminalCodex CLIOpenAI's command-line coding agentTelegram botYour Telegram bot, with automatic restartDiscord botYour Discord bot, with automatic restartOpenClawOpen-source personal AI assistant, active 24/7Hermes AgentAutonomous open-source AI agent

Deployment and automation

DockerThe container engine and Docker Composen8nYour automations, with no execution limitPortainerManage your Docker containers from your browserCoolifyDeploy your applications from Git, on your own serverUptime KumaMonitor your sites and servers, with alerts

Websites and databases

WordPressThe most widely used CMS, on a fast Nginx stackApache + PHP + MySQLApache, PHP and MariaDB, ready for your sitesMySQL (MariaDB)MySQL-compatible database serverPleskPlesk hosting panel, with your own licenceNextcloudYour own cloud for files, calendar and contacts

Network and security

WireGuardYour encrypted VPN, preinstalled as a paid optionVaultwardenA self-hosted password manager

Game servers

FiveMFiveM server with txAdmin and MariaDB, ready to useMinecraftTurnkey Minecraft Java server, plugins and mods includedRustRust server with automatic updates and Oxide or CarbonCounter-Strike 2Dedicated Counter-Strike 2 server, installed for youPalworldDedicated Palworld server, installed for youValheimDedicated Valheim server, installed for you
Gaming

Game servers

FiveM servertxAdmin, ESX, QBCoreMinecraft serverJava, Bedrock, modpacksRust serverOxide, Carbon, wipesNova-Life serverNova-Life: Amboise RP

Protection and tools

FiveM Anti-DDoSFree tools
Resources

Learn

DocumentationBlog

Assistance

ContactSLA commitment
View plans Client area Peering · AS213941

Security

Enable two-factor authentication (TOTP) on SSH

By the NVHCloud team · 2026-09-18 · 4 min read

With an SSH key, an attacker has to steal a file from your computer. With two-factor authentication, they also need your phone. This guide adds a six-digit code, renewed every 30 seconds, to every SSH login, on top of the key.

1. How it works

The TOTP standard (Time-based One-Time Password) generates codes from a shared secret and the current time. Any compatible app works: Google Authenticator, Microsoft Authenticator, Aegis, 2FAS, or the TOTP feature of a password manager. On the server side, the PAM module libpam-google-authenticator checks the codes, whatever app you use.

The result: logging in requires the SSH key, then the code. No password is asked.

2. Before you start

  • Key-based login must already work, with passwords disabled: see securing SSH.
  • The server clock must be accurate, since codes depend on the time. Check with timedatectl: the line System clock synchronized must say yes.
  • Keep a root session open throughout the procedure.

3. Install the module

apt install -y libpam-google-authenticator

4. Enrol your phone

Run the command as the account that will log in, not as root:

su - alex
google-authenticator -t -d -f -r 3 -R 30 -w 3

These options answer the tool's questions in advance: time-based codes (-t), each code usable only once (-d), at most three attempts every 30 seconds (-r 3 -R 30), and a tolerance of one code before and after to absorb a slight clock drift (-w 3).

A QR code appears in the terminal: scan it with your app. If the terminal is too small, enlarge the window or type in the secret key shown just below it.

⚠️ The tool also displays five single-use backup codes. Copy them into your password manager straight away. They are what will save you if you lose your phone.

5. Configure PAM

Open /etc/pam.d/sshd. Comment out the line that asks for the account password and add the TOTP module instead:

# @include common-auth
auth required pam_google_authenticator.so nullok

Commenting out common-auth is what prevents a password from being asked on top of the code. The nullok option lets accounts that have not enrolled a phone yet log in with the key alone: handy during setup. Remove it once every account is enrolled.

6. Configure OpenSSH

If you followed our hardening guide, open /etc/ssh/sshd_config.d/00-durcissement.conf and edit the existing line rather than adding one in another file: OpenSSH only keeps the first value it reads.

KbdInteractiveAuthentication yes
UsePAM yes
AuthenticationMethods publickey,keyboard-interactive

AuthenticationMethods publickey,keyboard-interactive requires both steps, in this order: the key first, then the code. Leave PasswordAuthentication no in place.

sshd -t && systemctl reload ssh
sshd -T | grep -E "kbdinteractive|authenticationmethods|usepam"

7. Test without locking yourself out

From a second terminal, keeping the current session open:

ssh alex@SERVER_IP

The key is checked, then the server displays Verification code:. Enter the code from the app. If the login fails:

  • The code is rejected: check the time on the server and on the phone.
  • A password is asked: the @include common-auth line is not commented out.
  • No code is asked: KbdInteractiveAuthentication is still set to no; check with sshd -T.

Details of the failure appear in journalctl -u ssh -n 30.

8. Backup codes and exceptions

Each backup code works once, in place of the app's code. If you are running low, run google-authenticator again to generate a new secret and new codes; you will then need to scan the new QR code.

Automated scripts, such as a backup that connects over SSH, cannot type a code. Exempt one specific technical account at the end of /etc/ssh/sshd_config:

Match User borg
    AuthenticationMethods publickey

Restrict that account to the bare minimum, as described in backups with Borg. And if you lose both your phone and your backup codes, the rescue console (VNC) in the client area, or failing that our support team, is how you get back in.

Frequently asked questions

Is SSH two-factor authentication useful if I already use a key?

It protects you against your key being stolen: a compromised computer, an unencrypted backup or a key copied by mistake. For a server that holds customer data or payments, it is a reasonable safeguard. For a test server, a well-protected key is usually enough.

What if I lose my phone?

Use one of the backup codes shown during enrolment, then run google-authenticator again to enrol a new phone. Without backup codes, use the rescue console in the client area or contact support.

Do I have to use the Google Authenticator app?

No. The server module has that name, but it follows the TOTP standard: any compatible app works, including Aegis, 2FAS, Microsoft Authenticator or the TOTP feature of a password manager.

Why is my code rejected when it is correct?

Almost always because of a clock drift between the server and the phone. Check that the server is synchronised with timedatectl, and that the phone's time is set automatically.

Linux NVMe VPS

Root access, Intel Xeon Gold and NVMe, delivered in 60 seconds. From 2,49 €/month.