这篇文章主要介绍vnc如何删除端口,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
创新互联公司专注于企业全网营销推广、网站重做改版、淮阳网站定制设计、自适应品牌网站建设、H5开发、商城系统网站开发、集团公司官网建设、外贸网站制作、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为淮阳等各大城市提供网站开发制作服务。
IIS7服务器管理工具 界面如下:
yum -y install tiger-server
config_file=”/etc/sysconfig/vncservers”
port_file=”/root/.vnc_port”
vncserver_file=which vncserver
function port_init {
last_port=5900
if [[ -e $port_file ]];then
old_port=cat $port_file
sed -i “s/$old_port\ +/5900\ +/g” $vncserver_file
echo “5900” > $port_file
fi
}
function modfy_port {
last_port=$1
if [[ $last_port == “” ]];then
echo “Please input the port you want “
else
if [[ -e $port_file ]];then
old_port=cat $port_file
sed -i “s/$old_port\ +/$last_port\ +/g” $vncserver_file
echo $last_port > $port_file
else
sed -i “s/5900\ +/$last_port\ +/g” $vncserver_file
echo $last_port > $port_file
fi
fi
}
function adduser {
if [[ $1 == “” ]];then
echo “Please input a user name”
else
user_num=grep -w VNCSERVERS $config_file|awk '{print $NF}'|cut -d":" -f1
latest_user_num=expr $user_num + 1
last_user=grep -w VNCSERVERS $config_file|awk '{print $NF}'|awk -F'"' '{print $1}'
sed -i “s/$last_user/$last_user\ $latest_user_num:$1/“ $config_file
echo “VNCSERVERSVNCSERVERARGS[$latest_user_num]=\”-geometry 1600x900 -alwaysshared\”” >> $config_file
useradd $1
echo “**“|passwd —stdin $1
fi
}
function deleteuser {
if [[ $1 == “” ]];then
echo “Please input the username to delete”
else
delete_user_match=$(egrep -w “[0-9]{1,3}:$1” $config_file|wc -l)
if [[ $delete_user_match -ne 1 ]];then
echo “Please make sure the user name is correct”
else
delete_user_num=egrep -w "[0-9]{1,3}:$1" $config_file|awk -F":$1" '{print $1}'|awk '{print $NF}'
sed -i “s/\ $delete_user_num:$1//“ $config_file
sed -i “s/.[$delete_user_num].//“ $config_file
userdel -r $1
fi
fi
}
function start {
#user_list=`grep -w VNCSERVERS $config_file|awk -F'"' '{print $2}'|sed 's/[0-9]\+://g' ` user_list=`grep -w VNCSERVERS $config_file|awk -F'"' '{print $2}'` echo $user_list for i in $user_list do user_port=$(echo $i|cut -d":" -f1) user=$(echo $i|cut -d":" -f2) #su - $user -c "vncserver -kill :$user_port" expect -c " set timeout 1200; spawn /usr/bin/su - $user -c "vncserver\ \:$user_port" expect { "Password:" {send "***"\r;exp_continue} "Verify:" {send "***"\r;} } expect eof;" done
}
function stop {
user_list=ps aux |grep vnc |grep rfbport |awk '{print $1 $12}'
for i in $user_list
do
user_port=$(echo $i|cut -d”:” -f2)
user=$(echo $i|cut -d”:” -f1)
su - $user -c “vncserver -kill :$user_port”
done
}
case $1 in
adduser)
adduser $2
;;
deleteuser)
deleteuser $2
;;
stop)
stop
;;
start)
start
;;
default_port)
port_init
;;
modify_port)
modfy_port $2
;;
*)
echo -e “Usage:\ncommands:\n adduser
;;
esac
以上是“vnc如何删除端口”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!
网页标题:vnc如何删除端口
网站地址:https://www.cdcxhl.com/article38/jijgpp.html
成都网站建设公司_创新互联,为您提供定制开发、品牌网站设计、微信小程序、网站维护、域名注册、网站导航
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联