#!/bin/bash
#新建用户用于加入堡垒机
echo "新建用户用于加入堡垒机,按任意键继续"
read -n1
yum install wget
mkdir -p /data/software
cd /data/software
curl -O http://down.yadeaiot.net:8000/lshell.tar.gz
tar -zxvf lshell.tar.gz
cd lshell
python setup.py install --no-compile --install-data=/usr/{pkg,local}/
groupadd lshell
useradd tspprod
passwd1=ay7AAhf3c3bfRPiL
echo $passwd1 | sudo passwd tspprod --stdin &>/dev/null
usermod -aG lshell tspprod
usermod tspprod -d /data/TSP_LOG/ -m
chsh -s /usr/bin/lshell tspprod
#修改配置文件
sed -i "s/allowed\s*:\s*\[\s*'ls',\s*'echo',\s*'ll'\s*\]/allowed         : ['ls','jmap','curl','less','export','echo','ll','grep','cat','awk','tail','pwd','sz','more','less']/g" /etc/lshell.conf
echo "请移步堡垒机界面-资产管理-资产列表-创建，增加服务器，如果不在组里面，记得授权资产"
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
systemctl restart sshd
