Configure SSH Client to Suppress Warnings on Ubuntu
When connecting to remote servers via SSH on Ubuntu Linux,
non-critical warning messages can clutter your terminal. This guide
provides a straightforward walk-through on how to configure your SSH
client to suppress these warnings by adjusting the LogLevel
configuration setting, ensuring a cleaner and more focused command-line
experience.
Understanding the LogLevel Directive
The SSH client’s LogLevel parameter controls the
verbosity of the messages printed to your terminal. By default, this is
usually set to INFO. To suppress warnings, you can change
this setting to one of the following values:
- ERROR: Suppresses warning messages but still displays critical error messages. (Recommended)
- QUIET: Suppresses all messages, including both warnings and errors.
You can apply this change globally for all users, individually for your user account, or temporarily for a single command.
Method 1: User-Specific Configuration (Recommended)
To suppress SSH warnings only for your logged-in user account, modify your personal SSH configuration file.
Open your user SSH configuration file using a text editor:
nano ~/.ssh/config(If the file does not exist, this command will create it).
Add the following configuration block to the file to apply the setting to all remote hosts:
Host * LogLevel ERROR(Replace
ERRORwithQUIETif you want to silence errors as well).Save and close the file. In Nano, press
Ctrl+O,Enter, thenCtrl+X.Set the correct file permissions to ensure security:
chmod 600 ~/.ssh/config
Method 2: System-Wide Configuration
To suppress SSH warnings for every user account on your Ubuntu system, modify the global SSH configuration.
Open the global SSH configuration file with administrative privileges:
sudo nano /etc/ssh/ssh_configScroll down to find the
Host *section. If it does not exist, add it to the bottom of the file.Add or modify the
LogLevelline under theHost *block:Host * LogLevel ERRORSave and close the file (
Ctrl+O,Enter,Ctrl+X).
Method 3: Suppress Warnings for a Single Session
If you want to run a specific SSH command without permanently
changing your configuration files, you can pass the
LogLevel option directly in your terminal command:
ssh -o LogLevel=ERROR user@remote_host