How to Enable SSH Password Authentication

February 21, 2025 / General Discussion

Some cloud server providers disable SSH password authentication by default for security reasons. Instead, they require public key authentication as the only method to log in via SSH.

Since SFTP (Secure File Transfer Protocol) relies on SSH for authentication, password-based SFTP login will also not work unless SSH password authentication is enabled. In such cases, users must use SSH keys to access the server via SFTP.

  1. Enable SSH Password Authentication:
    To enable SSH password authentication, follow these steps:

    1. SSH into your server as root.
    2. Open the SSH configuration file for editing:
      nano /etc/ssh/sshd_config
    3. Locate the following line:
      PasswordAuthentication no

      Change it to:

      PasswordAuthentication yes
    4. Save the file and exit.
    5. Restart the SSH service to apply the changes:
      sudo service ssh restart
  2. Enable Root Login Over SSH
    Some server providers disable direct SSH access for the root user and instead create a separate user (e.g., ubuntu) with sudo privileges.

    If you need root access, you can switch to a root shell using:

    sudo -i

    If you prefer to allow direct SSH login as root, follow these steps:

    1. Edit the SSH configuration file:
      nano /etc/ssh/sshd_config
    2. Locate the following line:
      PermitRootLogin no

      Change it to:

      PermitRootLogin yes
    3. Save the file and exit.
    4. Restart the SSH service:
      sudo service ssh restart
    5. Set a strong password for the root user:
      sudo passwd root

Warning: Enabling root login can be a security risk. Ensure you use a strong password and consider using SSH key authentication instead of passwords.

This way, you can enable SSH password authentication. If you, still get into any difficulty, feel free to seek help from our support specialists.

Learn How to Restart a Linux System using the reboot Command via SSH for efficient system management and smooth operation.

Leave a Reply

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