一、安装authbind包
解压authbind_2.1.1.tar.gz
cd authbind-2.1.1
make
返回结果:
cc -g -O2 -Wall -Wwrite-strings -Wpointer-arith -Wimplicit -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -DMAJOR_VER='"1"' -DMINOR_VER='"0"' -DLIBAUTHBIND='"/usr/local/lib/authbind/libauthbind.so.1"' -DHELPER='"/usr/local/lib/authbind/helper"' -DCONFIGDIR='"/etc/authbind"' -D_GNU_SOURCE -c -o authbind.o authbind.c
cc -g authbind.o -o authbind
cc -g -O2 -Wall -Wwrite-strings -Wpointer-arith -Wimplicit -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -DMAJOR_VER='"1"' -DMINOR_VER='"0"' -DLIBAUTHBIND='"/usr/local/lib/authbind/libauthbind.so.1"' -DHELPER='"/usr/local/lib/authbind/helper"' -DCONFIGDIR='"/etc/authbind"' -D_GNU_SOURCE -c -o helper.o helper.c
cc -g helper.o -o helper
cc -D_REENTRANT -g -O2 -Wall -Wwrite-strings -Wpointer-arith -Wimplicit -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -DMAJOR_VER='"1"' -DMINOR_VER='"0"' -DLIBAUTHBIND='"/usr/local/lib/authbind/libauthbind.so.1"' -DHELPER='"/usr/local/lib/authbind/helper"' -DCONFIGDIR='"/etc/authbind"' -D_GNU_SOURCE -c -o libauthbind.o -fPIC libauthbind.c
ld -shared -soname libauthbind.so.1 -o libauthbind.so.1.0 libauthbind.o -ldl -lc
make install
返回结果:
install -o root -g root -m 755 -d /usr/local/lib/authbind /usr/local/share/man/man1 /usr/local/share/man/man8
install -o root -g root -m 755 -s authbind /usr/local/bin/.
install -o root -g root -m 644 libauthbind.so.1.0 /usr/local/lib/authbind/.
strip --strip-unneeded /usr/local/lib/authbind/libauthbind.so.1.0
ln -sf libauthbind.so.1.0 /usr/local/lib/authbind/libauthbind.so.1
install -o root -g root -m 755 -s helper /usr/local/lib/authbind/.
chmod u+s /usr/local/lib/authbind/helper
install -o root -g root -m 755 -d /etc/authbind \
/etc/authbind/byport /etc/authbind/byaddr /etc/authbind/byuid
二、普通用户使用authbind绑定80端口
1.创建80文件
cd /etc/authbind/byport
touch 80
2.修改80文件的权限
chmod 755 80
3.修改80文件的拥有者和组群(chinavvv为普通用户)
chown chinavvv.chinavvv 80
三、普通用户使用80端口开启tomcat
启动命令之前加上authbind --deep,如:
使用普通用户启动tomcat,且tomcat使用80端口
authbind --deep ./startup.sh
四、添加tomcat自启动
备注:用户和路径请根据实际情况设置
vi /etc/rc.d/rc.local
添加以下内容:
su - chinavvv -c "authbind --deep tomcat1/bin/startup.sh"
备注:用户名和路径请根据实际情况设置
解压authbind_2.1.1.tar.gz
cd authbind-2.1.1
make
返回结果:
cc -g -O2 -Wall -Wwrite-strings -Wpointer-arith -Wimplicit -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -DMAJOR_VER='"1"' -DMINOR_VER='"0"' -DLIBAUTHBIND='"/usr/local/lib/authbind/libauthbind.so.1"' -DHELPER='"/usr/local/lib/authbind/helper"' -DCONFIGDIR='"/etc/authbind"' -D_GNU_SOURCE -c -o authbind.o authbind.c
cc -g authbind.o -o authbind
cc -g -O2 -Wall -Wwrite-strings -Wpointer-arith -Wimplicit -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -DMAJOR_VER='"1"' -DMINOR_VER='"0"' -DLIBAUTHBIND='"/usr/local/lib/authbind/libauthbind.so.1"' -DHELPER='"/usr/local/lib/authbind/helper"' -DCONFIGDIR='"/etc/authbind"' -D_GNU_SOURCE -c -o helper.o helper.c
cc -g helper.o -o helper
cc -D_REENTRANT -g -O2 -Wall -Wwrite-strings -Wpointer-arith -Wimplicit -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -DMAJOR_VER='"1"' -DMINOR_VER='"0"' -DLIBAUTHBIND='"/usr/local/lib/authbind/libauthbind.so.1"' -DHELPER='"/usr/local/lib/authbind/helper"' -DCONFIGDIR='"/etc/authbind"' -D_GNU_SOURCE -c -o libauthbind.o -fPIC libauthbind.c
ld -shared -soname libauthbind.so.1 -o libauthbind.so.1.0 libauthbind.o -ldl -lc
make install
返回结果:
install -o root -g root -m 755 -d /usr/local/lib/authbind /usr/local/share/man/man1 /usr/local/share/man/man8
install -o root -g root -m 755 -s authbind /usr/local/bin/.
install -o root -g root -m 644 libauthbind.so.1.0 /usr/local/lib/authbind/.
strip --strip-unneeded /usr/local/lib/authbind/libauthbind.so.1.0
ln -sf libauthbind.so.1.0 /usr/local/lib/authbind/libauthbind.so.1
install -o root -g root -m 755 -s helper /usr/local/lib/authbind/.
chmod u+s /usr/local/lib/authbind/helper
install -o root -g root -m 755 -d /etc/authbind \
/etc/authbind/byport /etc/authbind/byaddr /etc/authbind/byuid
二、普通用户使用authbind绑定80端口
1.创建80文件
cd /etc/authbind/byport
touch 80
2.修改80文件的权限
chmod 755 80
3.修改80文件的拥有者和组群(chinavvv为普通用户)
chown chinavvv.chinavvv 80
三、普通用户使用80端口开启tomcat
启动命令之前加上authbind --deep,如:
使用普通用户启动tomcat,且tomcat使用80端口
authbind --deep ./startup.sh
四、添加tomcat自启动
备注:用户和路径请根据实际情况设置
vi /etc/rc.d/rc.local
添加以下内容:
su - chinavvv -c "authbind --deep tomcat1/bin/startup.sh"
备注:用户名和路径请根据实际情况设置