vsftpd 다운로그레이드 소스설치
오래된 버전에선 다른것이 있을까 싶어 테스트 한것입니다. 혹시 필요하실분 있을까봐 올립니다.
환경은 "아마존리눅스2" 이기 때문에 CentOS7에서도 문제 없이 잘 설치 될것으로 생각 됩니다.
아래에서 환경설정에 대한 언급은 없는데요. 이유는 기존에 rpm으로 설치된 3 버전대를 그대로 사용해도 데몬이 잘 올라와서 없습니다.
1) 소스다운로드 및 컴파일
wget https://security.appspot.com/downloads/vsftpd-2.2.2.tar.gz
tar xvfz vsftpd-2.2.2.tar.gz; cd vsftpd-2.2.2/
아래 파일 열어 보면 어떻게 해야 하는지 나와 있다.
vim INSTALL
내가 특별히 해야 할것은 모르겠어. 컴파일함.
make
아래 오류가 발생하면 추가적인 패키지를 설치 한다.
/usr/bin/ld: cannot find -lcap
yum -y install libcap-devel
2) 기본환경 확인 후 인스톨
유저가 없으면 만들어 준다.
cat /etc/passwd | grep nobody
cat /etc/passwd | grep ftp
아래 디렉토리 없으면 만들어 준다.
/usr/share/empty/
centos6까지 사용하는 방식의 데몬 스크립트 인데. 이글 최 하단에 있다.
chmod 755 -R /etc/init.d/vsftpd
chown root.root -R /etc/init.d/vsftpd
[root@pabburi /usr/local/src/vsftpd/vsftpd-2.2.2] make install
if [ -x /usr/local/sbin ]; then \
install -m 755 vsftpd /usr/local/sbin/vsftpd; \
else \
install -m 755 vsftpd /usr/sbin/vsftpd; fi
if [ -x /usr/local/man ]; then \
install -m 644 vsftpd.8 /usr/local/man/man8/vsftpd.8; \
install -m 644 vsftpd.conf.5 /usr/local/man/man5/vsftpd.conf.5; \
elif [ -x /usr/share/man ]; then \
install -m 644 vsftpd.8 /usr/share/man/man8/vsftpd.8; \
install -m 644 vsftpd.conf.5 /usr/share/man/man5/vsftpd.conf.5; \
else \
install -m 644 vsftpd.8 /usr/man/man8/vsftpd.8; \
install -m 644 vsftpd.conf.5 /usr/man/man5/vsftpd.conf.5; fi
if [ -x /etc/xinetd.d ]; then \
install -m 644 xinetd.d/vsftpd /etc/xinetd.d/vsftpd; fi
위처럼 나왔다면 정상적으로 잘 된것이다. 파일이 복사 되었는지 확인해보자
ls -al /usr/local/sbin/vsftpd
# 아래와 같이 실행한 후 포트도 열려 있는지 확인
[root@pabburi /usr/local/src/vsftpd/vsftpd-2.2.2] /etc/init.d/vsftpd start
Starting vsftpd (via systemctl): [ OK ]
[root@pabburi /usr/local/src/vsftpd/vsftpd-2.2.2] netstat -antp
* 참고할것
rpm으로 설치 된것은 아래에 파일이 있다.
[root@pabburi /usr/local/src/vsftpd/vsftpd-2.2.2] whereis vsftpd
vsftpd: /usr/sbin/vsftpd /etc/vsftpd /usr/share/man/man8/vsftpd.8.gz
* 참고한곳
아래는 데몬 실행하는 스크립트
#!/bin/bash
#
# vsftpd This shell script takes care of starting and stopping
# standalone vsftpd.
#
# chkconfig: - 60 50
# description: Vsftpd is a ftp daemon, which is the program \
# that answers incoming ftp service requests.
# processname: vsftpd
# config: /etc/vsftpd/vsftpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x /usr/local/sbin/vsftpd ] || exit 0
RETVAL=0
prog="vsftpd"
start() {
# Start daemons.
CONF_FILE=/etc/vsftpd.conf
if [ -f $CONF_FILE ] ; then
site=`basename $CONF_FILE .conf`
echo -n $"Starting $prog for $site: "
/usr/local/sbin/vsftpd $CONF_FILE &
RETVAL=$?
[ $RETVAL -eq 0 ] && {
touch /var/lock/subsys/$prog
success $"$prog $site"
}
else
RETVAL=1
fi
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/$prog ]; then
stop
start
RETVAL=$?
fi
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL