I have followed the following steps


This is what I did

1) $ sudo useradd -s /bin/bash -m -d /home/newuser -g root newuser

Entered the Password for the newuser

2)$ sudo visudo And added after root newuser ALL=(ALL:ALL) ALL

3) $ sudo nano /etc/ssh/sshd_config Changed and set PasswordAuthentication as yes in /etc/ssh/sshd_config

4) sudo /etc/init.d/ssh restart Restarted the sshd

But when I try to login via Putty I get the following error:

"Disconnected: No supported authentication methods available (server sent: publickey)"

This is my /etc/ssh/sshd_config file

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile     %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

I understand this is risky and this is not for a public project.

I appreciate any help.

  • Rather than linking to a separate page, can you show which actual commands you ran (without the passwords of course)? That should give us a better idea of what's happening. – l0b0 Oct 1 '14 at 11:44
  • I modified the post to include the steps I took. – Samosa Oct 1 '14 at 12:19
  • @Samosa check logs, also try to create another user and do not include it to root group. – alexus Jan 20 '15 at 20:21

As others noted at the linked page, this is a bad idea. Passwords are generally much less secure than using public/private key pairs.

That said, if the server sent just publickey it isn't using the new configuration yet. Try restarting sshd.

  1. vi /etc/ssh/sshd_config
  2. Edit the file

    # Authentication:
    LoginGraceTime 120
    PermitRootLogin without-password
    StrictModes yes

    Please edit the permitRootLogin in the file shown above.

    After the changes:

    # Authentication:
    LoginGraceTime 120
    PermitRootLogin yes
  3. Please restart your ssh service using this command:

    /etc/init.d/ssh restart

To save some Ubuntu neophytes like myself some time, newer Ubuntu instances no longer use sshd reload. Instead it is asking for:

sudo restart ssh

Please see this SO link for more details: https://superuser.com/questions/214799/no-etc-init-d-sshd-file-ubuntu-ec2

  • This is entirely unrelated to the actual problem. – Sven Jul 2 '15 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.