0

I can ssh into a Linux node on the cloud with root. I've created another user, web, and I want to add my ssh keys to that user. Here's what I've tried so far (as root):

mkdir -p /home/web/.ssh
cp ~/.ssh/authorized_keys /home/web/.ssh/authorized_keys
chown web /home/web/.ssh
chgrp web /home/web/.ssh
chown -R :web /home/web/.ssh
chmod -R g+w /home/web/.ssh
find /home/web/.ssh -type d -exec chmod g+s '{}' \;
systemctl reload sshd

I'm pretty sure I'm over-setting the permissions but regardless I still can't ssh into the server as the web user. Box is Fedora 21 on Digital Ocean.

What am I missing?

Anthon
  • 79,293
blented
  • 109
  • There's an entire wiki on SSH here:

    http://unix.stackexchange.com/tags/ssh/info

    It has troubleshooting tips for when stuff isn't working

    – blented Mar 05 '15 at 22:12

1 Answers1

1

Your permissions are too lax.

chmod u=rwx,go= .ssh    # 0700
chmod u=rw,go= .ssh/*   # 0600

I'm going to assume that the user/group you have specified are the correct values for whatever uses /home/web as its home directory.

To diagnose this kind of error it's best to look at the daemon/auth logs on the server. See the tag here for more details.

Chris Davies
  • 116,213
  • 16
  • 160
  • 287
  • As root I set the permissions for /home/web/.ssh and /home/web/.ssh/* as you suggested. My /var/log/daemon.log and /var/log/auth.log are both non-existant, and ssh -vvv doesn't seem to be a valid option or run anything. I've read through the info here: http://unix.stackexchange.com/tags/ssh/info and tried everything listed as well but still can't ssh in as web. Any further ideas? – blented Mar 05 '15 at 22:32
  • For Fedora the security logs are apparently in /var/log/secure. Take a look to see why ssh is objecting to your login attempt. – Chris Davies Mar 06 '15 at 00:00