上传到Linux 服务器 /tmp 目录
关闭服务
service vsd stop
service iptables stop
chconfig iptables off
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g‘ /etc/selinux/config;
setenforce 0
检查旧版vsd 版本
vsd -v
卸载旧版vsd
yum remove -y vsd
安装依赖包:
yum install -y libcap libcap-devel tcp_wrappers tcp_wrappers-devel
编译安装源码包
tar -xzvf vsd-3.0.3.tar.gz
cd vsd-3.0.3
vim builddefs.h
#ifndef VSF_BUILDDEFS_H
#define VSF_BUILDDEFS_H
#define VSF_BUILD_TCPWRAPPERS
#define VSF_BUILD_PAM
#undef VSF_BUILD_SSL
#endif /* VSF_BUILDDEFS_H */
sed -i ‘s/UTF8 ON/DISABLE UTF8 ON/g‘ opts.c
make && make install
mkdir /etc/vsd/
cp vsd.conf /etc/vsd/
cp RedHat/vsd.pam /etc/pam.d/
sed -i ‘s/lib\//lib64\//g‘ /etc/pam.d/
修改配置文件(去掉后面注释)
vi /etc/vsd/vsd.conf
anonymous_enable=No
local_enable=YES
write_enable=YES
dirmessage_enable=YES
max_clients=100
#listen_port=8080
pasv_min_port=30000
pasv_max_port=30100
local_root=/
chroot_local_user=YES
allow_writeable_chroot=YES
启动并查看vsd
/usr/local/sbin/vsd &
netstat -tunlp | grep 21
/usr/local/sbin/vsd -v
cp /usr/local/sbin/vsd /usr/sbin/vsd
制作启动脚本
vim /etc/xinetd.d/vsd
disable = yes
vim /etc/init.d/vsd
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: vsd
# Required-Start: $local_fs $network $named $remote_fs $syslog
# Required-Stop: $local_fs $network $named $remote_fs $syslog
# Short-Description: Very Secure Daemon
# Description: vsd is a Very Secure daemon. It was written completely from
# scratch
### END INIT INFO
# vsd This shell script takes care of starting and stopping
# standalone vsd.
#
# chkconfig: - 60 50
# description: Vsd is a daemon, which is the program \
# that answers incoming service requests.
# processname: vsd
# config: /etc/vsd/vsd.conf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
RETVAL=0
prog="vsd"
start() {
# Start daemons.
if [ -d /etc ] ; then
for i in `ls /etc/vsd/vsd.conf`; do
site=`basename $i .conf`
echo -n $"Starting $prog for $site: "
/usr/local/sbin/vsd $i &
RETVAL=$?
[ $RETVAL -eq 0 ] && {
touch /var/lock/subsys/$prog
success $"$prog $site"
}
echo
done
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
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
授权755
chmod 755 /etc/init.d/vsd
chkconfig vsd on
验证
service vsd restart
vsd -v
--禁止本地用户访问操作系统
usermod -s /sbin/nologin user