Recently got a Linux cloud server, but every time landing Linux is good trouble, so daoteng the next SSH no secret landing.
Linux:centos 6.5, bring your own SSH
Mac:yosemite, bring your own SSH
Steps:
1. Create key
? .SSH Ssh-keygen-T rsagenerating Public/private RSA key pair. Enterfile inch whichTo save the key (/users/yinkw/.SSH/id_rsa): <--Direct Enter enter passphrase (empty forno passphrase): <--Direct Enter enter same passphrase Again:your identification has been saved inch/users/yinkw/.SSH/Id_rsa. Your public key has been savedinch/users/yinkw/.SSH/id_rsa.pub.The Key fingerprint is: -: -: the: This section of the middle is hidden.:d 1 [email protected]the key's Randomart image is:+--[RSA2048]----+| ooooo=o+ | | ... +o= + E | | . *.+ . || . =.+ || S=. || . O | | || || |+-----------------+? .SSHLltotal --RW-------1YINKW Staff1.6KTen 6 A: Oneid_rsa <--private key-rw-r--r--1YINKW Staff 399BTen 6 A: OneId_rsa.pub <--Public Key
2. Copy the public key to Linux
? . SSH SCP id_rsa.pub [email protected]19.29.~~: ~/. SSH [email protected] 119.29. ~ ~ ' id_rsa.pub 399 0. 4kb/s : XX
3. Linux, public key content appended to Authorized_keys
[Email protected]]~/. SSH 41 root root 0 September : authorized_ Keys1399 October 6: Id_rsa.pub[[email Protected]]~/. SSH cat id_rsa.pub >> Authorized_keys
4. Mac Test
? SSH [Email protected] 119.29. ~ ~ Login: Thu Oct 6 : £101.106. ~ ~
Eh, what's going on, it's useless to restart the sshd service, but you can already use Rsakey to log in
5. Linux off passwd Login
/etc/ssh/sshd_config:
Permitemptypasswords No
I feel safer when I turn off the passwd landing.
--done--
Mac no secret login to Linux