教你如何搭建编译服务器安装加密系统
一.怎么装Ubuntu 16.04?
可以参考博客:U盘安装 Ubuntu 16.04
二.ubuntu降低内核版本
降低内核版本目的是为了安装加密系统软件
可以参考博客:Ubuntu Linux内核版本升级或降级到指定版本(基于ubuntu 18.04示例)
可以参考博客:Ubuntu 切换系统默认启动内核
- 1.查看内核版本uname -a , 一般都是4.15.0的, 需要降低内核版本到 4.4.0-xx , 下面以4.4.0-21 为例子:
apt-cache search linux| grep 4.4.0-21
- 2.安装4.4.0-21内核:
sudo apt-get install linux-headers-4.4.0-21-generic linux-image-4.4.0-21-generic linux-image-extra-4.4.0-21-generic
- 3.修改内核默认启动顺序:
sudo vim /etc/default/grub
GRUB_DEFAULT="1> 3"
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="find_preseed=/preseed.cfg auto noprompt priority=critical locale=en_US"
- 4.生效配置 , 重启系统即可
sudo update-grub
reboot
你可能会碰到的问题:
-
1.重启后还是原来的内核版本:
此时需要卸载原来的内核, 以便开机默认就是4.4.0-21内核
可以参考博客1:Ubuntu删除多余内核
-
2.内核降低后, 以太网卡没有, 不能上网:
原因是降低内核后, 缺少以太网卡驱动, 此时可以使用usb转网卡, 安装万能的以太网卡驱动
可以参考博客: ubuntu18.04 更新内核后网卡驱动失效,不能上网
三.安装亿赛通加密系统:
-
1.准备安装包: ultrasec_V300R006C05_amd64.deb
安装包在FTP目录:
ftp://soft@192.168.80.2/%E4%BA%BF%E8%B5%9B%E9%80%9A
sudo dpkg -i ultrasec_V300R006C05_amd64.deb
- 2.安装成功后重启, 执行usec , 初始登录截图如下:
usec
- 3.根据对应的提示 1.登录 2.设置服务地址:
服务器地址: 192.168.80.2
端口:8020
-
4.出现下面的界面表示登录成功了:
-
5.卸载加密软件方法:
sudo uninstall_ultrasec
四.安装ssh server 和 samba , 添加用户
- 1.建议更换软件下载源服务器安装速度会快很多, 下面我选择了的是Huawei云, 也可以选择阿里云
sudo apt-get update
sudo apt-get ugrade
sudo apt-get install samba
sudo apt-get install openssh-server
- 2.将机械硬盘挂载在/home2 目录下:
可以参考博客:ubuntu挂载新硬盘的方法
可以参考博客:Ubuntu 配置磁盘挂载到指定目录
#查看磁盘空间占用情况,从大小上区分可知/dev/sdb1是机械硬盘设备
df -h
#查看/dev/sdb1的UUID
sudo blkid /dev/sda2
#格式化硬盘格式为ext4
sudo mkfs ext4 /dev/sdb1
#设置自动挂载
sudo vim /etc/fstab
最后加上
UUID=04d4935a-82bb-49b3-99ee-ef576ce6db60 /home2 ext4 defaults 0 2
#重新挂载
sudo mount -a
-
3.设置下usec的工作区, 增加/home2
-
4.最后使用下面的脚本, 根据提示可创建用户和对应的samba目录, 非常的方便
#!/bin/bash
GROUP_NAME=tozed
SMBFILE=/etc/samba/smb.conf
enable_samba()
{
homedir=$2
echo "[$1]" >> $SMBFILE
echo -e "\tcomment = smbshare home directory" >> $SMBFILE
echo -e "\tpath = /$homedir/$1" >> $SMBFILE
echo -e "\tbrowseable = yes" >> $SMBFILE
echo -e "\tpublic = yes" >> $SMBFILE
echo -e "\twriteable = yes" >> $SMBFILE
echo -e "\tvalid users = $1" >> $SMBFILE
echo -e "\tforce user = $1" >> $SMBFILE
echo -e "\tforce group = $GROUP_NAME" >> $SMBFILE
echo -e "\tavailable = yes" >> $SMBFILE
echo -e "\tunix charset = UTF-8" >> $SMBFILE
echo -e "\tdos charset = cp936" >> $SMBFILE
echo "" >> $SMBFILE
sudo smbpasswd -a $1
sudo systemctl restart smbd.service
}
delete_samba()
{
echo "===>Start to delete samba config..."
sudo sed -i "/^\[$1\]/,/^\[/{//!d}" $SMBFILE
sudo sed -i "/^\[$1\]/d" $SMBFILE
echo "===>Start to delete samba passwd..."
sudo smbpasswd -x $1
echo "===>Start to restart samba service..."
sudo systemctl restart smbd.service
}
change_samba_passwd()
{
sudo smbpasswd $1
sudo systemctl restart smbd.service
}
add_user()
{
egrep "^$GROUP_NAME" /etc/group >& /dev/null
if [ $? -ne 0 ]; then
sudo groupadd $GROUP_NAME
fi
id $1 >& /dev/null
if [ $? -ne 0 ]; then
# sudo useradd -g $GROUP_NAME -m $1
sudo useradd -d /$HOME_NAME/$1 -m -s /bin/bash -g $GROUP_NAME $1
sudo passwd $1
sudo chown $1:$GROUP_NAME -R /$HOME_NAME/$1
# if [ "$HOME_NAME" != "home" ]; then
# sudo mkdir -p /$HOME_NAME/$1
# sudo chown $1:$GROUP_NAME -R /$HOME_NAME/$1
# fi
sudo chmod 755 /$HOME_NAME/$1
echo -e "Add \"/$HOME_NAME/$1\" successfully! \n"
else
echo -e "This user is already exist: $1 \n"
fi
}
PROC_ST_INPUT_USERNAME=0
PROC_ST_SELECT_OPTION=1
PROC_ST_SAMBA_SET=2
PROC_ST_HOME_SEL=3
PROC_ST_USER_ADD=4
state=$PROC_ST_INPUT_USERNAME
while :
do
case $state in
$PROC_ST_INPUT_USERNAME)
echo "*****************************************"
echo "* input \"ls\" to view all users"
echo "* Ctrl+C to quit"
echo "input user name which you want to set:"
read username
echo -e "input: $username \n"
if [ "$username" = "ls" ]; then
grep bash /etc/passwd
elif [ "$username" != "" ]; then
state=$PROC_ST_SELECT_OPTION
fi
;;
$PROC_ST_SELECT_OPTION)
echo "*****************************************"
ls /home*
echo "*****************************************"
echo "*select option"
echo "* 1 add user"
echo "* 2 del user"
echo "* 3 change user password"
echo "* 4 goto set samba"
read opt
if [ "$opt" = "2" ]; then
id $username >& /dev/null
if [ $? -ne 0 ]; then
echo -e "There's no this user: $username \n"
state=$PROC_ST_SAMBA_SET
else
if [ -d /home2/$username ]; then
sudo rm -rf /home2/$username
fi
sudo userdel -rf $username
if [ $? -ne 0 ]; then
echo -e "Some Error! \n"
state=$PROC_ST_INPUT_USERNAME
else
echo -e "Delete user \"$username\" successfully! \n"
state=$PROC_ST_SAMBA_SET
fi
fi
elif [ "$opt" = "3" ]; then
sudo passwd $username
state=$PROC_ST_SAMBA_SET
elif [ "$opt" = "4" ]; then
state=$PROC_ST_SAMBA_SET
else
state=$PROC_ST_HOME_SEL
fi
;;
$PROC_ST_HOME_SEL)
echo ""
echo "-----------------------------------------"
df /home*
echo "*****************************************"
echo "* Select home direction:"
echo "* 1 /home"
echo "* 2 /home2"
echo "* 3 return"
read homesel
state=$PROC_ST_USER_ADD
if [ $homesel = 1 ] ; then
HOME_NAME=home
elif [ $homesel = 2 ]; then
HOME_NAME=home2
else
state=$PROC_ST_SELECT_OPTION
fi
;;
$PROC_ST_USER_ADD)
add_user $username
state=$PROC_ST_SAMBA_SET
;;
$PROC_ST_SAMBA_SET)
grep "\[$username\]" $SMBFILE
if [ $? -ne 0 ]; then
smbst="notshared"
else
smbst="shared"
fi
echo "*****************************************"
echo "* Samba status of \"$username\" is: $smbst"
echo "* Please select your option:"
echo "* 1 add samba"
echo "* 2 del samba"
echo "* 3 change samba passwd"
echo "* 4 return"
read opt
if [ $opt != 4 ]; then
sudo chmod 766 $SMBFILE
fi
state=$PROC_ST_INPUT_USERNAME
if [ $opt = 1 ]; then
enable_samba $username $HOME_NAME
elif [ $opt = 2 ]; then
delete_samba $username
elif [ $opt = 3 ]; then
change_samba_passwd $username
fi
if [ $? -eq 0 ]; then
echo -e "Option successfully! \n"
fi
;;
esac
done
今天的文章编译服务器配置_加密服务器分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/87156.html