How to copy authorized_keys to another user on linux?
6,018
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 ssh here for more details.
Related videos on Youtube
Author by
blented
Updated on September 18, 2022Comments
-
blented over 1 year
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?
-
blented about 9 yearsAs 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: unix.stackexchange.com/tags/ssh/info and tried everything listed as well but still can't ssh in as web. Any further ideas?
-
roaima about 9 yearsFor Fedora the security logs are apparently in
/var/log/secure
. Take a look to see whyssh
is objecting to your login attempt.