Linux SSH 암호 없이 로그인
1966 단어 Linux
예를 들어 서버 A(192.168.0.1), B(192.168.0.2)가 있는데 각각 다른 응용을 배치하지만 서버를 왔다 갔다 전환하는 것이 비교적 번거로우므로 ssh 명령으로 A 서버에서 두 대의 서버를 배치할 수 있다.
단계:
ssh-keygen -t rsa -f ~/.ssh/id_rsa -C " "
주의: 키의 파일 이름은 id 이어야 합니다xxx, 여기 xxx는 - t 매개 변수가 지정한 키 형식입니다.예를 들어 키 형식이rsa라면 키 파일 이름은 id 이어야 합니다rsa.
ssh-keygen이 설치되어 있지 않으면 설치하고 생성
yum install -y ssh-keygen
[root@VM_0_14_centos ~]# cd ~/.ssh/
[root@VM_0_14_centos .ssh]# ll
total 12
-rw------- 1 root root 0 Dec 17 10:00 authorized_keys
-rw------- 1 root root 1679 Mar 5 13:55 id_rsa
-rw-r--r-- 1 root root 393 Mar 5 13:55 id_rsa.pub
-rw-r--r-- 1 root root 701 Mar 5 13:33 known_hosts
[root@VM_0_14_centos .ssh]# pwd
/root/.ssh
[root@VM_0_14_centos .ssh]# ssh-copy-id -i ~/.ssh/id_rsa.pub -p 22 [email protected]
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -p '22' '[email protected]'"
and check to make sure that only the key(s) you wanted were added.
ssh-copy-id가 설치되어 있지 않으면 먼저 설치합니다
yum install -y ssh-copy-id
[root@VM_0_14_centos .ssh]# ssh [email protected] "cd /usr/local ; ls"
bin
elfin
etc
games
include
lib
lib64
libexec
sbin
share
src
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
바이너리 파일cat 또는tail, 터미널 디코딩 시 처리 방법cat으로 바이너리 파일을 보려고 할 때 코드가 엉망이 되어 식은땀이 났다. 웹에서 스크롤된 정보의 처리 방법과alias의 설정을 요약합니다. reset 명령을 사용하여 터미널을 재설정합니다.이렇게 하면 고치지 못하...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.