DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk9 min

How to Log Failed SSH Password Login Attempts on Linux

Use journald or the AUTH syslog log to see failed SSH passwords, then choose VERBOSE logging, pam_faillock, or audit records based on whether you need live events, extra detail, or persistent per-user history.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start with the host’s existing logging backend: follow the SSH unit with sudo journalctl -fu ssh.service on a system using systemd, or inspect /var/log/auth.log on Debian- and Ubuntu-style syslog setups. If normal records do not show enough detail, verify the effective sshd settings and raise LogLevel to VERBOSE temporarily; use PAM or audit facilities when you need persistent per-user accounting rather than connection-level events.

What a failed SSH password attempt looks like

OpenSSH writes authentication events through the AUTH syslog facility. A typical daemon record has the form Failed password for USER from ADDRESS port PORT ssh2. The same event can produce a PAM entry such as pam_unix(sshd:auth): authentication failure. The exact wording changes with the OpenSSH, PAM, and distribution release, so search by the stable ideas—Failed password, authentication failure, Invalid user, and the source address—rather than depending on one complete line.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

These records answer “what happened on this connection?” They do not, by themselves, create a durable counter for every account. A connection can generate several failures before it is closed, and retention depends on the host’s journal or syslog policy.

First identify where this Linux host records SSH events

systemd-journald

On a system where the SSH service is visible to systemd’s journal, follow new records with:

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
sudo journalctl -fu ssh.service

Ubuntu’s documentation uses the unit name ssh.service. Other distributions may register the daemon as sshd.service; use the unit name shown by that host’s service manager. The -f option follows new entries and -u limits the stream to the selected unit. Generate a deliberately unsuccessful login from a test client, then stop the follow mode with Ctrl+C.

Traditional syslog files

Ubuntu-style configurations commonly route AUTH messages to /var/log/auth.log:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo grep -E 'Failed password|authentication failure|Invalid user' /var/log/auth.log

Some distributions use a different secure/auth file, a journal-only configuration, or both. Do not assume that an empty auth.log means no failures occurred; first establish whether the daemon is writing to journald, text syslog, or both, and check the distribution’s retention and rotation policy.

When both backends are enabled

A host can forward the same AUTH event to the journal and a text file. The two views may differ in retention, timestamps, and fields. Choose one backend for routine monitoring and use the other to investigate gaps. Avoid counting lines from both as separate attacks unless you have de-duplicated them.

Check the effective sshd configuration before changing anything

The file you edit is not necessarily the final configuration: an included drop-in can override it. Ask the running configuration parser for the effective values:

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
sudo sshd -T | grep -E '^(loglevel|syslogfacility|maxauthtries|passwordauthentication|usepam)'

This displays the settings that matter for failed-password logging and its surrounding authentication path:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • loglevel: OpenSSH’s default is INFO. Higher levels produce more diagnostics.
  • syslogfacility: Determines the facility that the syslog backend routes; the standard SSH setup uses AUTH.
  • maxauthtries: Limits failures allowed on one connection. Ubuntu’s current Jammy manual lists a default of 6.
  • passwordauthentication: Shows whether password authentication is enabled at all. A disabled value means password guesses will not reach the password-authentication stage.
  • usepam: Indicates whether the PAM account and authentication stack participates, which matters for modules such as pam_faillock.

Run this check as the same configuration context used by the service. If the output differs from the line you planned to edit, locate the active include and change the authoritative file rather than adding a contradictory setting.

View failed attempts in real time

Using the journal

  1. Open an administrator shell or prefix the command with sudo.
  2. Start the stream: sudo journalctl -fu ssh.service (substitute the host’s SSH unit name when necessary).
  3. From a separate machine, make one test connection with an intentionally wrong password to a test account. Do not test against a production account you could lock out.
  4. Read the resulting daemon and PAM lines. Record the account name, source address, source port, and whether the username was reported as invalid.
  5. Stop following with Ctrl+C when the observation window ends.

Journal output is the quickest way to see an event as it arrives. It does not guarantee long-term storage: journal size limits, volatile journals, and retention settings vary by distribution.

Following a text log

For a syslog file, use a tailing command and filter the stream:

sudo tail -F /var/log/auth.log | grep -E 'Failed password|authentication failure|Invalid user'

-F follows the file across log rotation. If the distribution writes AUTH events to another file, substitute that path. Keep the unfiltered stream available when diagnosing a new release, because a distribution may use different wording or add context that your filter does not match.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Searching after an incident

Search the retained journal or rotated text logs for the same phrases and source address. Search separately for Invalid user: it identifies a username that the daemon could not resolve, while Failed password for USER generally names an account that reached password verification. A single address can appear in both categories.

Increase detail safely when INFO is insufficient

Ubuntu’s community documentation states that OpenSSH logs to AUTH at INFO by default and recommends VERBOSE when failed-attempt details are needed. Change the effective configuration in /etc/ssh/sshd_config or the active included drop-in:

LogLevel VERBOSE

Apply the change as a controlled operation:

  1. Edit the file that actually supplies the effective setting.
  2. Validate syntax without restarting the daemon:
sudo sshd -t
  1. If validation succeeds, reload the SSH service through the distribution’s service manager. On a host using the Ubuntu unit name, that is commonly sudo systemctl reload ssh.service; a host using sshd.service requires that unit name instead.
  2. Keep an existing administrative session open while reloading. Use a second session to confirm that new connections still work.
  3. Repeat sudo sshd -T | grep -E '^(loglevel|syslogfacility|maxauthtries|passwordauthentication|usepam)' and watch the journal or AUTH log for the additional records.

Return to INFO after the diagnostic window if the extra detail is no longer needed. OpenSSH’s manual warns that DEBUG-level logging violates user privacy and is not recommended. If a short, exceptional troubleshooting session requires a DEBUG level, define a start and end time, restrict access to the logs, and restore the prior level immediately afterward.

Understand what MaxAuthTries does—and does not do

MaxAuthTries is a per-connection guard, not an account-history database. The Ubuntu Jammy manual gives a default of 6 and states that once failures reach half that value, additional failures are logged. Thus, a client can produce several password failures on one TCP connection, and the daemon may close the connection when the limit is reached. A new connection starts a new allowance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Question What the mechanism records Scope
Did sshd reject a password? Daemon and often PAM authentication messages Individual event or connection
How many tries were allowed on one connection? MaxAuthTries behavior Per connection; default 6 in the cited Jammy manual
How many failures has this account accumulated over time? Not provided by MaxAuthTries Requires PAM failure accounting or another audit system

Track persistent per-user failures with pam_faillock

When the requirement is “count failures for each local account across connections,” use the PAM stack’s pam_faillock facility rather than trying to total sshd lines. The module records account failures at PAM stages commonly labeled preauth, authfail, and authsucc. Its configuration supports options including:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
  • audit, to include an audit trail for the module’s activity;
  • silent, to suppress selected user-facing messages;
  • no_log_info, to control informational logging; and
  • local_users_only, to limit accounting to local users.

The exact file locations, ordering, and required control flags are distribution-specific. PAM modules are evaluated in sequence, so placing pam_faillock in the wrong stages can produce no counter, count the wrong events, or lock accounts unexpectedly. Make a backup of the active PAM configuration, follow that distribution’s documented stack, and test with a noncritical account before enabling enforcement.

Faillock data is persistent account state, not merely a stream of sshd messages. It can therefore answer questions that journal searches cannot, such as whether one user has accumulated failures from several separate connections. Decide separately how and when counters are cleared; do not infer a reset policy from the presence of a single log line.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use audit records when you need an investigation trail

On systems configured for Linux audit, failed login investigations can use USER_LOGIN records with res=failed. Red Hat guidance describes examining these records alongside the account and source information. Audit records have a different purpose from sshd’s operational messages: they provide a structured security trail that can be correlated with other audited actions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Audit availability, rule sets, storage, and retention are distribution and site-policy decisions. If no matching records exist, verify that the audit service and appropriate login rules were enabled before the event; enabling them after an incident cannot reconstruct earlier attempts.

Choose the right method for your question

Need Best source Advantages Limitations
Watch new SSH failures now journald with journalctl -fu, or a tailed AUTH file Immediate, low setup effort Retention and wording vary; not a durable per-user counter
Review ordinary daemon events INFO-level sshd records Normal operational overhead May omit detail needed for a specific investigation
Capture more failed-attempt context temporarily LogLevel VERBOSE More detail without DEBUG’s extreme verbosity Requires a validated reload and a defined rollback window
Count failures by account across connections PAM pam_faillock Persistent per-user accounting PAM placement and policy are distribution-specific; can lock accounts
Build a broader forensic timeline Linux audit records, including USER_LOGIN with res=failed Structured, correlatable security events Only useful for periods and events covered by active audit rules

Common failure modes and fixes

No output from journalctl

  • Confirm the unit name: the host may use sshd.service rather than ssh.service.
  • Check sudo sshd -T to ensure you are examining the daemon that is actually running and that password authentication is enabled for the test path.
  • Look for a syslog file such as /var/log/auth.log; the host may route AUTH events there instead of retaining them in the journal.
  • Verify that your test connection reached this host and that a firewall, bastion, or other SSH endpoint did not generate the event elsewhere.

The file exists but contains no failed-password lines

Check the effective syslogfacility, the distribution’s routing rules, and rotated files. Search for the alternate phrases authentication failure and Invalid user, because message wording varies. If the daemon is at INFO and the needed context is absent, use a short VERBOSE window after validating the configuration.

Reload appears to do nothing

Run sudo sshd -t first; a syntax error prevents a safe reload. Then confirm that you edited the active file or drop-in and re-run sshd -T. Keep one existing session open so a configuration mistake does not remove your only administrative access.

Counts disagree between sources

Do not add journal lines, text-log lines, PAM counters, and audit records together. They have different scopes and can describe the same attempt. Select one authoritative source for the question you are answering, then use the others for correlation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Users are unexpectedly locked

This usually indicates a PAM policy or stack-order issue rather than an sshd logging problem. Review the active pam_faillock stages and options, test with a noncritical account, and follow the distribution’s documented reset procedure. Avoid deleting account-state files blindly: doing so can defeat the intended security policy or create an inconsistent stack.

A practical operating checklist

  1. Identify whether the host uses journald, syslog text files, or both.
  2. Find the SSH unit name and start a live stream with sudo journalctl -fu ssh.service or its equivalent.
  3. Inspect /var/log/auth.log on Ubuntu-style setups and search for the documented failure phrases.
  4. Record the effective values from sudo sshd -T | grep -E '^(loglevel|syslogfacility|maxauthtries|passwordauthentication|usepam)'.
  5. Use LogLevel VERBOSE only for the period in which INFO lacks required detail; validate with sudo sshd -t before reloading.
  6. Use pam_faillock for persistent per-user accounting and Linux audit for a structured investigative trail.
  7. Document the retention period, access controls, and rollback time for any increased logging.

Bottom line

For a quick answer, follow the SSH service in journald or search the AUTH log for Failed password. For richer daemon detail, temporarily raise LogLevel to VERBOSE and validate before reloading. For history that survives separate connections, configure the distribution’s PAM failure accounting; for a wider forensic record, use audit events. Treat MaxAuthTries as a per-connection limit, not as a per-user incident counter.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.