Level Goal
The password for the next level is stored in /etc/bandit_pass/bandit14 and can only be read by user bandit14. For this level, you don’t get the next password, but you get a private SSH key that can be used to log into the next level. Note: localhost is a hostname that refers to the machine you are working on
ssh -i "sshkey.private" bandit14@localhost -p 2220
🤔 ssh란?
SSH(Secure Shell)는 원격지 호스트 컴퓨터에 접속하기 위해 사용되는 인터넷 프로토콜이다.
기존의 유닉스 시스템 셸에 원격 접속하기 위해 사용하던 텔넷은 암호화가 이루어지지 않아 보안상 위험이 있다. 여기에 암호화 기능을 추가하여 나온 프로토콜이다.
- 원격 접속을 하기 때문에 기본적으로 CLI 상에서 작업한다.
- 서버에 접속할 때 비밀번호 대신 key를 제출한다.
- 기본 포트는 22번이다.
🤔 동작 방식
SSH Key = Public Key + Private Key
- 키를 생성하면 공개키와 비공개키가 만들어진다.
- 비공개키는 로컬 머신에 위치하고, 공개키는 리모트 머신에 위치한다.
- SSH 접속을 시도하면 SSH Client가 로컬머신의 비공개키와 리모트머신의 공개키를 비교해서 둘이 일치하는지를 확인한다.
🤔 Command 사용법
ssh <host주소> <옵션>
-p: 포트 설정-i: 키 파일 사용
bandit13@bandit:~$ ssh -i "sshkey.private" bandit14@localhost -p 2220
bandit14@bandit:~$ cd etc/bandit_pass/
bandit14@bandit:/etc/bandit_pass$ cat bandit14
fGrHPx402xGC7U7rXKDaxiWFTOiF0ENq
bandit14 : fGrHPx402xGC7U7rXKDaxiWFTOiF0ENq