Cybersecurity
Securing Server Admin Access: Two-Step Authentication, SSH Keys, and Access Logs
Admin access is the most valuable door into a company server. This checklist covers two-step authentication, SSH keys, access restrictions, and access logs that should exist before someone else finds the gap.
SEO and Content Specialist
7 min read Reviewed by Legia Cybersecurity Team
Short answer: securing server admin access means making sure only authorized people can get in, and that every entry is recorded. Four core steps: log in with SSH keys, not passwords; two-step authentication for administrator accounts; one account per person with only the rights needed; and access logs that are stored separately and reviewed. After that, revoke access immediately when someone leaves or changes roles.
Admin access, which on Linux is usually through SSH and on Windows through Remote Desktop or an administrator console, is the door with the greatest rights on a server. Whoever holds it can read data, change configuration, and erase traces. That is why securing server admin access deserves to come before more complicated protections. This article is a checklist that can be done step by step, with references to OpenSSH, NIST, and CISA documentation.
Step 1: replace passwords with SSH keys
Passwords can be guessed repeatedly from the internet, while an SSH key is a public and private key pair where the private key is never sent over the network. In OpenSSH, PasswordAuthentication and PubkeyAuthentication are both yes by default, so a freshly installed server still accepts passwords until you turn that off.
What to do:
- Create a key per person. According to the
ssh-keygendocumentation, run without arguments it generates an Ed25519 key, and for RSA keys the default size is 3,072 bits, which it considers sufficient. - Protect the private key with a passphrase. A private key without a passphrase that is stolen from a laptop can be used immediately.
- Install the public key in each admin’s account, then test key login from a new session.
- Turn off password login (
PasswordAuthentication no) once key login is proven to work. Test the configuration withsshd -tand keep one old session open until the new session gets in, so you do not lock yourself out. - Restrict root login. The default
PermitRootLoginisprohibit-password, which rejects passwords for root. The valuenocloses root login entirely; admins log in with a personal account and raise privileges when needed.
Step 2: add two-step authentication for administrator accounts
Two-step authentication (MFA) asks for two different factors to prove identity, for example something you have (a device) and something you know (a password or PIN). NIST SP 800-63B-4, the final edition of July 2025, defines level AAL2 as proof of possession and control of two distinct authentication factors. CISA states that users who enable MFA are significantly less likely to be hacked, and that any MFA is better than no MFA.
Not all MFA is equal. A practical order:
| Method | Note |
|---|---|
| FIDO/WebAuthn security key | Phishing-resistant. CISA calls phishing-resistant MFA the standard to strive for |
| Authenticator app (one-time code or in-app approval) | Far better than no MFA. For approval notifications, CISA suggests number matching to counter push bombardment attacks |
| SMS code | Restricted by NIST SP 800-63B-4 (use of the PSTN for out-of-band verification has restricted status). Use only when there is no alternative |
| Email code | NIST prohibits it as an out-of-band method |
Apply MFA in the three places most often forgotten: the cloud and hosting provider panel, the accounts that hold code repositories and release pipelines, and the entry point to servers (VPN, bastion, or SSH itself). OpenSSH supports combining methods through AuthenticationMethods, for example publickey,keyboard-interactive, which requires the SSH key first and then a second step. That second method must be enabled and configured on the server; do not copy the settings without testing them.
Step 3: one account per person, only the rights needed
A shared admin account removes the ability to answer the most basic question during an incident: who did this? Use these principles:
- One account per person. No admin account whose password or key is used by two people.
- Rights by role. Someone who only monitors does not need the right to change configuration.
- Limit who may log in. The
AllowUsersdirective in OpenSSH permits only user names matching the patterns you write, including restriction by source address. - Limit attempts.
MaxAuthTries(default 6) limits authentication attempts per connection. - Separate service accounts. Applications running on the server use their own accounts without interactive login rights.
- Record the holder of each privileged account in a list updated whenever people change.
Access must also be revocable quickly. When an employee or vendor leaves, privileged accounts are the first to be revoked, at the moment the working relationship ends. The full order is in IT Offboarding Procedure for Departing Employees.
Step 4: access logs that are stored and reviewed
Access logs answer four things: who got in, when, from where, and what was done with elevated rights. The sshd documentation states that unless turned off with the quiet option, the start, authentication, and end of every connection are recorded in the system log, while the sshd_config documentation gives LogLevel a default of INFO and warns that DEBUG level can compromise user privacy and is not recommended as a permanent setting.
The OWASP Logging Cheat Sheet lists events that should be logged, and some are relevant to admin access:
| Log | Reason |
|---|---|
| Authentication successes and failures | Repeated failures mark password-guessing attempts |
| Authorization failures | Admins or accounts trying things beyond their rights |
| Administrative functions: adding or deleting users, changing rights | Rights changes are the trace most sought during an incident |
| Use of default, shared, or break-glass accounts | Should be rare and always explainable |
| System configuration changes | Shows who changed what |
Then protect the logs themselves:
- Store them separately from the server being logged, so an attacker who takes over the server cannot erase the trail. OWASP suggests keeping logs on a separate partition and, where possible, moving them to read-only media.
- Restrict who may read the logs and record access to them.
- Synchronize the time of all servers so the order of events can be reconstructed.
- Do not log passwords, tokens, or encryption keys inside the logs.
- Set a retention period according to your legal and contractual needs, and do not delete before it passes.
- Schedule reviews. Logs that are never read are useful only after the fact. NIST SP 800-92 (2006) gives guidance on setting up and running log management at the organization level.
If the logs record activity inside an application rather than access to the server, the relevant reading is What Is an Activity Log.
Final checklist
- SSH password login is turned off, all admins use keys with passphrases.
- Direct root login is restricted or closed.
- MFA is active on the cloud panel, repositories, and the server entry point.
- Each admin has their own account, with no shared accounts.
- A list of privileged account holders exists and is updated whenever people change.
- Login is limited to permitted users and, where possible, addresses.
- Access logs are sent to a separate place, server time is synchronized.
- There is a schedule to review logs and to test that access revocation really works.
- There is a plan for when admin access is abused, such as in Cyber Incident Response Plan.
How Legia does it
In the Server Installation & Management service, Legia handles server security in the form of configuration hardening, operating system patching, firewalls, SSH keys and two-step authentication for admin access, per-person access rights, and access logs. The results are recorded in the configuration documentation, and server and infrastructure accounts remain in your company’s name so they can be revoked at any time. The work begins with an infrastructure audit of 3 to 7 working days that produces a ranked findings report. To check the configuration of a running server, including exposed services and software versions, Vulnerability Assessment is available. Other services in this pillar are on the Cyber Security page.
Frequently asked questions
Are SSH keys safer than a long password?
Generally yes for remote access, because the private key is not sent during login and cannot be guessed from the internet. The condition is that the private key is protected by a passphrase and the device storing it is secure.
Is two-step authentication needed for a server reachable only through a VPN?
It is still recommended. A VPN narrows who can reach the server, but a leaked VPN account gives an attacker the same access. MFA on the VPN and on admin accounts closes both points at once.
Can an admin account be shared if the team is small?
Preferably not. A shared account makes logs unable to point to a person and makes revoking access harder when someone leaves. Personal accounts with only the rights needed do not take much extra work.
How often should admin access be reviewed?
Every time someone joins, changes duties, or leaves, plus a periodic review of the privileged account list on a schedule you set yourself according to company policy.
Sources
- OpenBSD, sshd_config(5)man.openbsd.org
- OpenBSD, sshd(8)man.openbsd.org
- OpenBSD, ssh-keygen(1)man.openbsd.org
- NIST, SP 800-63B-4 Digital Identity Guidelines: Authentication and Authenticator Managementpages.nist.gov
- CISA, Multifactor authenticationcisa.gov
- OWASP, Logging Cheat Sheetcheatsheetseries.owasp.org
- NIST, SP 800-92 Guide to Computer Security Log Managementcsrc.nist.gov

