0

I need to set up a Linux submodule for a testing system which will SSH into the module and run programs over the remote shell. To do this, I'm trying to run an SSH daemon with publickey access. The problem is no matter what I do I can't seem to login. Everytime I try I get something like this:

sampler@DESKTOP-RDJ0BBU:~$ ssh -p4203 sampler@localhost
Sampler@localhost's password:
Permission denied, please try again.
Sampler@localhost's password:
Permission denied, please try again.
Sampler@localhost's password:
Permission denied (publickey,password).
sampler@DESKTOP-RDJ0BBU:~$

I know I'm typing in the correct password and yet it doesn't let me log in. My account is a non-administrator named "Sampler" and the Linux account is "sampler" with the same password. (I've tried both upper and lower case 'S').

This is my /etc/ssh/sshd_config:

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

# What ports, IPs and protocols we listen for
Port 4203
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
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
# !chroot not yet implemented on windows!
UsePrivilegeSeparation no

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

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin no
AllowUsers Sampler
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 know I'm at least getting a response from my ssh service because when I disable the server with sudo service ssh stop I start getting the error ssh: connection to host localhost port 4203: Connection Refused.

I have a copy of my .ssh directory in both /home/sampler/ and /mnt/c/Users/Sampler, although I don't believe that's the issue since my password doesn't work either.

Edit: I've already read the posts from this thread and as you can see by my config file, none of them have solved my issue.

Thomas
  • 121

1 Answers1

2

I found my problem. When I set up my allowed users, I entered the windows username, Sampler, instead of the unix name, sampler.

# Authentication:
LoginGraceTime 120
PermitRootLogin no
AllowUsers sampler # <--- Here
StrictModes yes

I'm still having issues with connecting from outside computers and publickeys, but that seems to be another set of issues.

Thomas
  • 121