這篇文章主要介紹vnc如何刪除端口,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!
創(chuàng)新互聯(lián)公司專注于企業(yè)全網(wǎng)營銷推廣、網(wǎng)站重做改版、淮陽網(wǎng)站定制設(shè)計、自適應(yīng)品牌網(wǎng)站建設(shè)、H5開發(fā)、商城系統(tǒng)網(wǎng)站開發(fā)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為淮陽等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。
IIS7服務(wù)器管理工具 界面如下:
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如何刪除端口”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
網(wǎng)頁標(biāo)題:vnc如何刪除端口
網(wǎng)站地址:http://www.rwnh.cn/article38/jijgpp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)、品牌網(wǎng)站設(shè)計、微信小程序、網(wǎng)站維護(hù)、域名注冊、網(wǎng)站導(dǎo)航
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)