서버나누기
domain
email
www
각각
sudo apt update
sudo apt upgrade
sudo apt -y install net-tools
설치
domain-
email
www
각각 하나씩 설치후
ip넣기 dns 168.126.63.1
www ip 설정
sudo nano /etc/netplan/50[tab]
dhcp4: no
addresses: [10.0.2.102/24]
gateway4: 10.0.2.2
nameservers:
addresses: [168.126.63.1]
netplan apply
nano /etc/hosts로 이름바꾸기
서버는안전한가
cd /var/log
tail -f auth.log
hydra -L user.txt -P passwd.txt 10.0.2.101
로그인이 가능한 서비스
#로그관리 및 저장
ftp,ssh,telnet,imap,mysql등은 아이디와 암호를 알고있으면 접속이 가능 (항상가능X)
www.st.kr 과 intra.st.kr의 웹페이지는 달라야 한다
#www를 외부접속 가능하도록 설정하라
외부접속하려면 네트워크를 NAT로 바꾸면된다
Xshell에서 ssh 192.168.0.210접속
sudo adduser st
비밀번호 123456
cd /home (으로 계정 만들어졌나 확인)
ls
(master st)
sudo adduser ksj
/var/www/html (웹 기본 페이지의 위치)
index.html(우선순위가 더 높다)
index.php
주인 : root
st.kr > /home/st/public_html
st
ksj.kr > /home/ksj/public_html
ksj
naver.com > /home/naver/public_html
naver
sudo adduser st (123456/enter)
info: Adding user `st' ...
info: Selecting UID/GID from range 1000 to 59999 ...
info: Adding new group `st' (1001) ...
info: Adding new user `st' (1001) with group `st (1001)' ...
info: Creating home directory `/home/st' ...
info: Copying files from `/etc/skel' ...
cd st
su
sudo passwd root
123456
su(root로 변경)
123456
cd st
ls
mkdir public_html
cd /etc/skel
ls
mkdir public_html
cd public_html/
mkdir includes
mkdir logs
mkdir auth
mkdir board
touch index.php
ls(확인)
cd includes/
touch header.php
touch tail.php
touch db.php
cd /home
ls
cd /var/www/html
nano index.php
#일반계정 홈페이지 작동시키기
http://192.168.0.210/~st 으로 확인가능
a2enmod userdir
systemctl restart apache2
cd /home
ls
cd st
ls
cd public_html/
ls
touch index.html
cd /home/st
ls -al
chown st:st index.html (pubilc_html에 소유자를 root에서 st로 바꿔준다)
ls -al
cd public_html/
ls -al(로 바뀐지 확인)
su st(st라는계정으로 바꾸라는뜻)
chmod 711 $HOME
chmod 755 ~/public_html
mkdir public_html
cd public_html/
touch index.html
cd ~
chmod 711 $HOME
chmod 755 ~/public_html
FTP연결
apt update
sudo apt -y install vsftpd
nano /etc/vsftpd.conf
write_enable=YSE
chroot_local_users=YES
chroot_list_enable=YES
ls_recuse_enable=YES
local_root=public_html
nano /etc/vsftpd.chroot_list에 이름추가
st
ksj
naver
su
sudo apt -y install lrzsz
su st
apt -y install lamp-server^ 만 설치하면 일반 사용자에서는 php가 정상적으로 작동하지 않는다
PHP-FPM(FPM:FastCGI process Manager)
apt -y install php8.3-fpm
a2enmod proxy_fcgi setenvif
a2enconf php8.3-fpm
systemctl restart php8.3-fpm apache2
create database st;
create user st@localhost identified by '123456';
grant all on st.* to st@localhost;
flush privileges;
create database lsw;
create user lsw@localhost identified by '123456';
grant all on lsw.* to lsw@localhost;
flush privileges;
create database naver;
create user naver@localhost identified by '123456';
grant all on naver.* to naver@localhost;
flush privileges;
mysql -u st -p st < webhack.sql
mysql
show databases;
use st;
select * from auth;