How to fix Missing argument. in SSH

SSHINTERMEDIATEMEDIUMUpdated Jan 4, 2026ยท 223 views

SSH throws a 'missing argument' error when a command-line option or config file keyword doesn't have its required value. This typically happens with flags like -p, -i, or -o that expect arguments, or with malformed SSH config files.

Quick fix

Fixes Missing argument.

# Wrong - missing value
ssh -p user@hostname
ssh -i user@hostname
ssh -o PubkeyAuthentication user@hostname

# Correct - with values
ssh -p 2222 user@hostname
ssh -i ~/.ssh/my_key user@hostname
ssh -o PubkeyAuthentication=yes user@hostname
  1. Check your SSH command syntax
  2. Fix -o option syntax
  3. Validate your SSH config file
  4. Fix file encoding if using SSH config
ssh โ€” error
# Wrong - missing value
ssh -p user@hostname
ssh -i user@hostname
ssh -o PubkeyAuthentication user@hostname
# Correct - with values
ssh -p 2222 user@hostname
ssh -i ~/.ssh/my_key user@hostname
ssh -o PubkeyAuthentication=yes user@hostname
Missing argument.

What this error means

The 'missing argument' error means SSH encountered an option or keyword that requires a value but none was provided, or the value format is incorrect. This can occur in two contexts: (1) when using SSH command-line flags that need arguments (like -p for port or -i for identity file), or (2) when the ~/.ssh/config file has syntax errors where keywords lack their required parameters.

Typical symptoms

  • SSH command fails with 'Missing argument' or 'Missing yes/no argument'
  • Error message specifies a line number in ~/.ssh/config
  • Connection commands work with some options but fail when adding new flags
  • VS Code Remote or other SSH tools fail to connect
  • Scripts that build SSH commands dynamically start failing

Common causes

  1. Command-line option missing its required value (e.g., ssh -p without port number)
  2. Incorrect -o option syntax (using spaces instead of = sign, e.g., -o 'BatchMode yes' instead of -o 'BatchMode=yes')
  3. SSH config file has malformed directives (e.g., Host without a pattern argument)
  4. LocalForward or RemoteForward using wrong separator (colon instead of space)
  5. Extra whitespace in config file options causing parser to misinterpret values
  6. File encoding issues (BOM markers or CRLF line endings in SSH config file)

How to fix "Missing argument."

1Check your SSH command syntax

Review the command for any options that lack values. Common options requiring arguments:

bash
# Wrong - missing value
ssh -p user@hostname
ssh -i user@hostname
ssh -o PubkeyAuthentication user@hostname

# Correct - with values
ssh -p 2222 user@hostname
ssh -i ~/.ssh/my_key user@hostname
ssh -o PubkeyAuthentication=yes user@hostname

Ensure all flags have their required arguments provided.

2Fix -o option syntax

When using SSH options with -o, use an equals sign (=) between the option and value, or wrap the entire option-value pair in quotes:

bash
# Recommended - with equals sign
ssh -o BatchMode=yes user@hostname
ssh -o ConnectTimeout=10 user@hostname

# Alternative - with quotes
ssh -o 'BatchMode yes' user@hostname

# Wrong - space without quotes
ssh -o BatchMode yes user@hostname  # Error: missing argument
3Validate your SSH config file

If you see an error with a specific line number in ~/.ssh/config, open the file and check that line:

bash
vim ~/.ssh/config
# or
cat ~/.ssh/config

Common config errors:

bash
# Wrong
Host                    # Missing pattern argument
LocalForward 8888:localhost:9999  # Wrong syntax
IdentityFile  ~/.ssh/id_rsa  # Multiple spaces (may cause issues)

# Correct
Host github.com
LocalForward 8888 localhost:9999
IdentityFile ~/.ssh/id_rsa
4Fix file encoding if using SSH config

SSH config parsing can fail if the file has wrong line endings or a BOM marker. Check this in vim:

bash
vim ~/.ssh/config

# Inside vim, check line endings:
:set fileformat?
# If output is 'fileformat=dos', change it:
:set fileformat=unix

# Check for BOM:
:set bomb?
# If output shows 'bomb', remove it:
:set nobomb

# Save and exit
:wq
5Test your SSH configuration

After making fixes, validate the configuration by attempting a test connection:

bash
# Test basic SSH connectivity
ssh -T git@github.com

# Test with verbose output to see which config is applied
ssh -T -v git@github.com

# Check if config file is valid without connecting
# (Some SSH versions support this)
ssh -G git@github.com | head -5

Verbose output (-v) will show you exactly which configuration options are being loaded and where the error occurs.

Advanced notes

SSH Option Styles: Some tools generate SSH commands with inconsistent option styles. The safest approach is always using -o name=value format. Some older SSH implementations may require quotes around options: -o 'name value'. Config File Precedence: SSH reads both /etc/ssh/ssh_config (system-wide) and ~/.ssh/config (user-specific). Check both files if experiencing unexpected errors. IDE and Tool Integration: VS Code, GitHub Copilot, and other tools that auto-generate SSH configs sometimes produce malformed syntax. Manual validation of auto-generated config files is recommended. Boolean Options: Options that accept yes/no values are strict about syntax - use -o 'OptionName=yes' or -o 'OptionName no' with proper spacing or equals signs.

Frequently asked questions

What does "Missing argument." mean?
The 'missing argument' error means SSH encountered an option or keyword that requires a value but none was provided, or the value format is incorrect. ssh/config file has syntax errors where keywords lack their required parameters.
How do I fix "Missing argument."?
SSH throws a 'missing argument' error when a command-line option or config file keyword doesn't have its required value. This typically happens with flags like -p, -i, or -o that expect arguments, or with malformed SSH config files.
What causes "Missing argument."?
Command-line option missing its required value (e.g., ssh -p without port number) Incorrect -o option syntax (using spaces instead of = sign, e.g., -o 'BatchMode yes' instead of -o 'BatchMode=yes') SSH config file has malformed directives (e.g., Host without a pattern argument)
Is the "Missing argument." error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading