P
P
Pavel Padozhnikov2015-08-10 20:15:07
linux
Pavel Padozhnikov, 2015-08-10 20:15:07

What is wrong with my head or with ssh?

I tried to make passwordless access via ssh, but something is not going well for me. Several times I managed to log in (transfer a file) without a password, but everything comes back. Link to instructions for creating passwordless access.
What could be causing the error?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Alexey Sergey, 2015-08-10
@PaveL152

try to execute on the machine where you need access:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
and in general points 6-10 are done by the wonderful ssh-copy-id utility (comes with openssh). from a machine with freshly generated keys:
ssh-copy-id [email protected]_host

S
Sergey, 2015-08-10
@edinorog

probably something with the head)

R
Ruslan Fedoseev, 2015-08-10
@martin74ua

well, we create a key without a password, send the public key to the client in the .ssh/authorized_keys directory, and that's it, from that moment we go to the remote host by key. Well, essno we go by the user whose home contains the public key.
and what can't you do?

A
abcd0x00, 2015-08-11
@abcd0x00

Somehow, I also suffered for a very long time with ssh, I redid everything from the beginning a hundred times.
It turned out that the problem was in the rights to the .ssh directory. Moreover, this is not a simple thing, but regulated by new settings, so in the old documentation there may not be a need to comply with them.
man sshd_config

StrictModes
             Specifies whether sshd(8) should check file modes and ownership
             of the user's files and home directory before accepting login.
             This is normally desirable because novices sometimes accidentally
             leave their directory or files world-writable.  The default is
             “yes”.  Note that this does not apply to ChrootDirectory, whose
             permissions and ownership are checked unconditionally.

When ssh is in trouble, know that there is a debug mode for both the client and the server. There you can trace everything down to the smallest detail.
Start the server (sshd) with the -d option (repeating up to three times) and it will give you information about where the client is going.

S
Saboteur, 2015-08-10
@saboteur_kiev

Pavel Padozhnikov : Known_hosts file. what does he do?
known_hosts stores snapshots of remote servers that you have already connected to. Serves to ensure that the remote server could not be replaced imperceptibly.
For passwordless operation, you need two things:
have a private key on the server you are connecting from, for example /home/user/.ssh/id_rsa
have a public key on the server you are connecting to, for example in /home/user/.ssh/authorized_keys

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question