I'm new to Linux in general but also even newer to the Window's 10 Ubuntu subsystem. I've been trying to set up ssh and so I set up a static ip address and logged into my router and forwarded port 22 as per usual. Using my public ip, I found a site that I was able to plug that into and the site confirmed that port 22 had indeed been forwarded.

After that I followed the instructions on the link https://superuser.com/questions/1111591/how-can-i-ssh-into-bash-on-ubuntu-on-windows-10 and installed openssh-server, added my username and set up my sshd_config file as such:

# 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 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 username
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    
#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

After setting up open ssh I tried using PuTTY to login to my server using my public IP as the address, myusername as the user and the user's password as the password and it gives me a

Access Denied

error message. I'm positive that I'm using the right password for that user name. Why am I still being denied access? If any of you can spot something amiss or maybe a step I missed, your help would be very appreciated.

  • What do ssh's logs report? – muru Nov 18 '16 at 16:32
  • I've tried to look for the /var/log/auth.log and I'm told that there is No such file or directory – lehast22 Nov 18 '16 at 16:38
  • Are you running your wsl elevated ? – Aserre Dec 5 '16 at 12:57
  • You cannot run WSL "elevated". It is a kernel-level component. Can you tell us your Windows 10 build number? Before a certain build, it was impossible to connect to network reliably from inside WSL instance. – Erkin Alp Güney May 12 '17 at 18:56
  • 1
    Probably you should open port 22 in your Windows Firewall: tomshardware.co.uk/faq/id-3114787/… – pa4080 Apr 30 '18 at 15:13

One thing to suspect when your SSH login is rejected with no apparent reason is whether the server has security updates due. In such a case OpenSSH denies any login attempt without even logging it.

Type sudo apt update && sudo apt upgrade at the server's local terminal and see if anything changes.

| improve this answer | |

Take ownership of the painting

This error usually occurs when you try to access a file or directory without sufficient privileges. This happens if you are not an administrator or if you do not have a folder. To resolve the problem, simply assign the property to your account. For that, proceed as following:

Find the problematic folder, right-click and choose Properties from the menu.

Go to the Security tab and click the Advanced button.

Find the Owner section at the top and click Edit.

The Select User or Group window will appear. In the Enter the name of the object to be selected field, enter Administrators or enter your username. Now click the Check Names button. If everything is in order, your contribution will change. Click OK to save the changes.

The owner section will now change. Check Replace Owner on Subcontainers and Objects, then click Apply and OK to save the changes. Some users suggest that you check the Replace all secondary object permission entries option so that you can do this as well.

In some cases, you may have to manually assign permissions to your account. To do this, follow these simple steps:

Access advanced security settings. The list of all users will appear. If your user account is not listed, click the Add button.

Click Select a principal.

Now enter the name of your user account, click Check Names, and then click OK. We have already shown you how to proceed to step 5 above, so be sure to check. Set Type to allow and apply to this folder, subfolders, and files, and check Full Control. Now click on the OK button.

| improve this answer | |

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.