"Ssh"의 두 판 사이의 차이
둘러보기로 가기
검색하러 가기
잔글 |
잔글 |
||
57번째 줄: | 57번째 줄: | ||
<pre>vi /etc/ssh/sshd_config | <pre>vi /etc/ssh/sshd_config | ||
PermitRootLogin yes | PermitRootLogin yes | ||
+ | # PermitRootLogin forced-commands-only | ||
PasswordAuthentication yes | PasswordAuthentication yes | ||
</pre> | </pre> |
2016년 2월 16일 (화) 13:03 판
ssh 사용법을 정리 합니다.
목차
SSH 개요
SSH Key 관리
- RSA 암호화 방식으로 공개키와 비밀키를 생성 합니다.
- 암호화 방식 : rsa, dsa, rsa1
- ~/.ssh/authorized_keys : Client의 공개키를 저장
- ~/.ssh/id_rsa.pub : 공개키
- ~/.ssh/id_rsa : 비밀키
- ~/.ssh/known_hosts : SSH 방식으로 접속한 사용자 정보 저장
cd ### ssh-keygen -t rsa : DSA 암호화 방식을 사용할 경우 ssh-keygen -t rsa ### Enter file in which to save the key (/home/hduser/.ssh/id_rsa): 비밀키를 저장할 파일 경로 입력 ### Enter passphrase (empty for no passphrase): 비밀번호 입력 (자동 로그인을 원할 경우 enter 키를 누르세요) chmod 700 ~/.ssh chmod 644 ~/.ssh/* chmod 600 ~/.ssh/id_rsa
- Key를 다른 서버로 복사
ssh-copy-id -i ~/.ssh/id_rsa.pub hduser@node201.hadoop.com ### ssh hduser@node201.hadoop.com 명령을 사용하여 암호 입력 없이 로그인 가능
- Key를 다른 서버로 복사 2
scp ~/.ssh/id_rsa.pub hduser@node201.hadoop.com:aaa ### 다른 서버에서 아래 작업을 진행 cat aaa >> ~/.ssh/authorized_keys
사용자 매뉴얼
환경 설정 파일
- /etc/ssh/sshd_config
- /etc/hosts.allow
- /etc/hosts.deny
명령어 실행
- 원격 명령어 실행
ssh hduser@node201.hadoop.com "ls -alF"
파일 전송
- 파일/폴더 전송
- -P 포트
- -r 하위 폴더도 모두 전송
scp -P 22 ~ hduser@node201.hadoop:/home/hduser/~
접속 차단
vi /etc/ssh/sshd_config PermitRootLogin yes # PermitRootLogin forced-commands-only PasswordAuthentication yes
service ssh restart
Putty에서 사설키로 자동 접속
.ssh/id_rsa 파일을 ~.pem 파일로 복사
puttygen.exe 파일을 실행
Conversions -> Import Key 메뉴를 선택한 후 ~.pem 파일을 지정
Save private key 메뉴를 선택하여 ~.ppk 파일로 저장
Putty에서 접속 -> SSH -> 인증 메뉴에서 ~.ppk 등록한 후 세션 메뉴에서 user@server 로 접속
FileZilla에서 사설키로 자동 접속
"편집 -> 설정 -> 연결 -> FTP -> SFTP -> Add key file" 메뉴에서 ~.pem 파일을 등록 합니다.