Home > Backend Development > PHP Tutorial > PHP checks whether the public key is available

PHP checks whether the public key is available

王林
Release: 2023-04-07 12:16:01
Original
3248 people have browsed it

PHP checks whether the public key is available

How to use RSA public key for ssh remote login verification
1. Generate the key on the local machine

$ssh-keygen -t
rsa
Copy after login

Generate the second version of the key based on the ssh protocol. If you still use rsa1, it is time to upgrade.
2. Copy the generated id_rsa.pub public key file to the remote server

$scp
id_rsa.pub bsduser@192.168.1.188:mykey.pub
Copy after login

3. Log in to the remote server with password

$ssh 192.168.1.188
-l bsduser
Copy after login

Note here that it is not cp, but cat; not ">", but the operation of ">>":

%cat mykey.pub
>> $HOME/.ssh/authorized_keys
Copy after login

4. Restart sshd

#/etc/rc.d/sshd
restart
Copy after login

5. If the login test

$ssh
bsduser@192.168.1.188
Copy after login

succeeds, you don’t need to enter a complicated and easily leaked password. But the condition is that you must protect your key file information.

The above content is for reference only!

Recommended tutorial: PHP video tutorial

The above is the detailed content of PHP checks whether the public key is available. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template