title: Could not open authorized, Permission denied
body: <p>I got this error when trying to set SSH login on my user.</p>
  
  <pre><code>Feb  2 13:56:57 (none) sshd[4075]: debug1: trying public key file //.ssh/authorized_keys
  Feb  2 13:56:57 (none) sshd[4075]: debug1: Could not open authorized keys '//.ssh/authorized_keys': Permission denied
  Feb  2 13:56:57 (none) sshd[4075]: debug1: restore_uid: 0/0
  Feb  2 13:56:57 (none) sshd[4075]: Failed publickey for soinfit from 79.182.124.164 port 52788 ssh2
  Feb  2 13:56:57 (none) sshd[4075]: debug3: mm_answer_keyallowed: key 0x7f3d8516faf0 is not allowed
  Feb  2 13:56:57 (none) sshd[4075]: debug3: mm_request_send entering: type 22
  Feb  2 13:56:57 (none) sshd[4075]: debug2: userauth_pubkey: authenticated 0 pkalg ssh-rsa [preauth]
  </code></pre>
  
  <p>The files permissions are:</p>
  
  <pre><code>root@(none):/home/soinfit# ls -lah
  total 12K
  drwx------ 3 soinfit soinfit 4.0K Feb  2 13:30 .
  drwxr-xr-x 4 root    root    4.0K Feb  2 12:08 ..
  drwx------ 2 soinfit soinfit 4.0K Feb  2 13:36 .ssh
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/tnO2G.png" alt="enter image description here"></p>
  
  <p>My sshd-config:</p>
  
  <pre><code># 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 ::
  #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
  #Privilege Separation is turned on for security
  UsePrivilegeSeparation yes
  
  # Lifetime and size of ephemeral version 1 server key
  KeyRegenerationInterval 3600
  ServerKeyBits 768
  
  # Logging
  SyslogFacility AUTH
  LogLevel DEBUG3
  
  # Authentication:
  LoginGraceTime 120
  PermitRootLogin yes
  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 no
  </code></pre>
  
  <p>I have done restart to the SSH service and to the machine.</p>
  
  <p>I saw this post:
  <a href="https://stackoverflow.com/questions/20688844/sshd-gives-error-could-not-open-authorized-keys-although-permissions-seem-corre">SSHD Gives error could not open Authorized Keys, although permissions seem correct</a></p>
  
  <p>The answer given there did not helped me.
  When I try to run <code>restorecon -FRvv ~/.ssh</code> I get:</p>
  
  <pre><code>root@(none):/home/soinfit/.ssh# restorecon -FRvv ~/.ssh
  -bash: restorecon: command not found
  </code></pre>
  
  <p>EDIT</p>
  
  <pre><code>root@(none):~# grep soinfit /etc/passwd
  soinfit:x:1001:1001::/:/bin/sh
  </code></pre>