본문 바로가기

Wargame/Bandit

[ Docker ] Bandit Wargame 만들기 - 2번 문제 ( 4 / 33 )

1. Bandit2 목표

The password for the next level is stored in a file called spaces 
in this filename located in the home directory

Commands you may need to solve this level
ls , cd , cat , file , du , find

 

2. Bandit2 구현

# 비밀번호 root 입력 접속
ssh -oStrictHostKeyChecking=no root@localhost -p 2220

chown -R root:root /home/bandit2/.[!.]*

echo UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK > /home/bandit2/"spaces in this filename"

useradd bandit3 && echo -e "UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK\nUmHadQclWmgdLOKQ3YNgjWxGoRMb5luK" | passwd bandit3

chmod 640 /home/bandit2/"spaces in this filename"

chown bandit3:bandit2 /home/bandit2/"spaces in this filename"

# root 사용자 이외에도 bandit2 폴더는 읽기, 실행(접근) 권한은 있어야 하므로 실행 및 접근 권한을 준다.
chmod 755 /home/bandit3

chown root:root /home/bandit3

exit

 

3. Bandit2 문제풀의

# bandit2 로 설정한 패스워드를 입력하여 접속한다.
# CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9
ssh bandit2@localhost -p 2220

ls -la

cat spaces\ in\ this\ filename

cat "spaces in this filename"