How to fix Bad owner or permissions on /home/user/.ssh/config in SSH

SSHBEGINNERMEDIUMUpdated May 28, 2026· 360 views

SSH refuses your config because the file or .ssh dir has loose permissions. Fix with chmod 600 ~/.ssh/config and chmod 700 ~/.ssh.

Quick fix

Fixes Bad owner or permissions on /home/user/.ssh/config

chmod 700 ~/.ssh
  1. Fix permissions on .ssh directory
  2. Fix permissions on .ssh/config file
  3. Fix ownership of .ssh directory and contents
  4. Fix all SSH file permissions at once
ssh — error
chmod 700 ~/.ssh
Bad owner or permissions on /home/user/.ssh/config

What this error means

SSH is a security-sensitive application that validates file permissions before reading configuration files. The .ssh/config file contains sensitive information about your SSH connections, including host configurations and sometimes credential hints. To prevent unauthorized users from tampering with this file or accessing sensitive data, SSH enforces strict permission requirements: the .ssh directory must have 700 permissions (drwx------), the config file must have 600 permissions (-rw-------), and both must be owned by your user account. If SSH detects that these requirements aren't met, it refuses to use the configuration file to prevent potential security breaches.

Typical symptoms

  • SSH connection attempts fail with 'Bad owner or permissions on .ssh/config'
  • Error message specifies the exact path to your config file
  • Commands like 'ssh hostname' or 'git clone' fail if they use SSH config
  • The error occurs even though the .ssh directory exists and contains files
  • Issue may appear after copying .ssh folder from another system or user

Common causes

  1. The .ssh/config file has permissions other than 600 (e.g., 644, 664, or world-readable)
  2. The .ssh directory has permissions other than 700 (e.g., 755 or world-accessible)
  3. The .ssh/config file is owned by a different user than your current account
  4. The .ssh directory is owned by a different user than your current account
  5. Inheritance is enabled on the .ssh folder (Windows), causing inherited permissions from parent directory
  6. File was copied from another system where it had different permissions or owner
  7. Group-writable permissions exist on the directory or file

How to fix "Bad owner or permissions on /home/user/.ssh/config"

1Fix permissions on .ssh directory

The .ssh directory must have 700 permissions (owner read/write/execute only). Run:

bash
chmod 700 ~/.ssh

Verify the permissions:

bash
ls -ld ~/.ssh

Should show: drwx------ ... username

2Fix permissions on .ssh/config file

The config file must have 600 permissions (owner read/write only). Run:

bash
chmod 600 ~/.ssh/config

Verify the permissions:

bash
ls -l ~/.ssh/config

Should show: -rw------- 1 username groupname ...

If the file doesn't exist yet, SSH won't complain, but when you create one, ensure you set these permissions immediately.

3Fix ownership of .ssh directory and contents

The .ssh directory and all its contents must be owned by your user account. Run:

bash
chown -R $USER ~/.ssh

Verify ownership:

bash
ls -l ~/.ssh

All files should list your username as the owner. If the group is different from your primary group, you can also fix it with:

bash
chown -R $USER:$USER ~/.ssh
4Fix all SSH file permissions at once

If you have multiple files with permission issues, run all fixes together:

bash
chmod 700 ~/.ssh
chmod 600 ~/.ssh/config
chmod 600 ~/.ssh/authorized_keys
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub

Common permissions for SSH files:
- ~/.ssh/ → 700 (drwx------)
- ~/.ssh/config → 600 (-rw-------)
- ~/.ssh/id_rsa (private key) → 600 (-rw-------)
- ~/.ssh/id_rsa.pub (public key) → 644 (-rw-r--r--)
- ~/.ssh/authorized_keys → 600 (-rw-------)

5Windows: Disable inherited permissions (if applicable)

If you're on Windows (WSL or native OpenSSH), inherited permissions from parent directories can cause issues:

1. Open Windows Explorer and navigate to your .ssh folder (usually C:\Users\YourUsername\.ssh)
2. Right-click the .ssh folder → Properties
3. Click the Security tab → Click Advanced
4. Click "Disable inheritance" button
5. Choose "Remove all inherited permissions from this object"
6. Click OK

Then set explicit permissions:
- In Advanced Security Settings, click "Add"
- Click "Select a principal", then type your Windows username
- Click "Check Names"
- Give yourself Full Control
- Remove all other entries except SYSTEM

Click OK to apply and close all dialogs.

6Test SSH connectivity

After fixing permissions, test that SSH works:

bash
ssh -v localhost

The -v flag shows verbose output. If you see the error again, it will display which file has the problem. A successful connection will show:

bash
...
debug1: Configuration found in /home/user/.ssh/config
...

You can also test a specific SSH key or host:

bash
ssh -i ~/.ssh/id_rsa username@remote-host

If the error persists after fixing permissions, verify that you're using the correct username and that the .ssh directory path is correct (it should always be in your home directory).

Advanced notes

Advanced considerations:

SSH Daemon vs. SSH Client: The error occurs in the SSH client when reading .ssh/config. The SSH daemon (sshd) has separate permission requirements for server-side files like /etc/ssh/sshd_config and ~/.ssh/authorized_keys.

Umask Settings: If you frequently recreate .ssh files, check your umask setting. A default umask of 0077 will create files with 600 permissions automatically. Set it with: umask 0077 or add to your shell RC file (.bashrc, .zshrc, etc.).

SSH Agent Permissions: If using SSH agent (ssh-agent), the socket directory /tmp/ssh-* must have 700 permissions. SSH is strict about this to prevent hijacking attacks.

WSL (Windows Subsystem for Linux): WSL can have permission issues due to Windows NTFS filesystem not supporting Unix permissions the same way. If you copied .ssh from Windows to WSL, you may need to manually fix permissions even though they appear correct in Windows Explorer. Run the chmod commands in WSL terminal.

NFS Mounted Home Directories: On systems where home directories are NFS-mounted, permission enforcement might differ. If you get the error despite having correct permissions shown by ls, contact your system administrator about NFS permission enforcement.

Git and SSH Config: When Git uses SSH (for cloning private repos), it reads your SSH config to find the appropriate key. This error will prevent Git from working with SSH-based repositories until fixed.

Frequently asked questions

What does "Bad owner or permissions on /home/user/.ssh/config" mean?
SSH is a security-sensitive application that validates file permissions before reading configuration files. ssh/config file contains sensitive information about your SSH connections, including host configurations and sometimes credential hints. ssh directory must have 700 permissions (drwx------), the config file must have 600 permissions (-rw-------), and both must be owned by your user account.
How do I fix "Bad owner or permissions on /home/user/.ssh/config"?
SSH refuses your config because the file or .ssh dir has loose permissions. Fix with chmod 600 ~/.ssh/config and chmod 700 ~/.ssh.
What causes "Bad owner or permissions on /home/user/.ssh/config"?
The .ssh/config file has permissions other than 600 (e.g., 644, 664, or world-readable) The .ssh directory has permissions other than 700 (e.g., 755 or world-accessible) The .ssh/config file is owned by a different user than your current account
Is the "Bad owner or permissions on /home/user/.ssh/config" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading