Home >Backend Development >PHP Tutorial >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
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
3. Log in to the remote server with password
$ssh 192.168.1.188 -l bsduser
Note here that it is not cp, but cat; not ">", but the operation of ">>":
%cat mykey.pub >> $HOME/.ssh/authorized_keys
4. Restart sshd
#/etc/rc.d/sshd restart
5. If the login test
$ssh bsduser@192.168.1.188
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!