2 Star 10 Fork 5

chuanjiao10/kasini3000_agent_linux

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
alibaba_cloud_linux_install_powershell.bash 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
chuanjiao10 提交于 2024-09-11 15:35 . 更新:版本
#
if rpm -q centos-release | grep -Eq 'el6'
then
echo 'not support centos6'
exit 1
fi
if grep -Eq 'Soaring Falcon' /etc/issue || grep -Eq 'Hunting Beagle' /etc/*-release
then
echo 'Alibaba Cloud Linux'
if [ -h /usr/bin/pwsh ]
then
echo 'powershell installed Alibaba Cloud Linux'
if grep -Eq 'powershell' /etc/ssh/sshd_config
then
echo 'powershell_sshd_good'
exit 0
else
echo '' >> /etc/ssh/sshd_config
echo 'Subsystem powershell /usr/bin/pwsh -sshs -NoLogo -NoProfile' >> /etc/ssh/sshd_config
echo 'UseDNS no' >> /etc/ssh/sshd_config
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
systemctl restart sshd.service
echo 'powershell_sshd_fixed'
exit 0
fi
else
echo 'installing powershell now'
curl -o /etc/yum.repos.d/microsoft.repo https://packages.microsoft.com/config/rhel/8/prod.repo
yum remove -y powershel
yum install -y powershell
if [ $? -ne 0 ]
then
echo 'install fall'
exit 3
else
echo 'install powershell sucess'
if grep -Eq 'powershell' /etc/ssh/sshd_config
then
echo 'powershell_sshd_good'
exit 0
else
echo '' >> /etc/ssh/sshd_config
echo 'Subsystem powershell /usr/bin/pwsh -sshs -NoLogo -NoProfile' >> /etc/ssh/sshd_config
echo 'UseDNS no' >> /etc/ssh/sshd_config
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
systemctl restart sshd.service
echo 'powershell_sshd_fixed'
exit 0
fi
fi
fi
else
echo 'linux not Alibaba Cloud Linux'
exit 2
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/chuanjiao10/kasini3000_agent_linux.git
git@gitee.com:chuanjiao10/kasini3000_agent_linux.git
chuanjiao10
kasini3000_agent_linux
kasini3000_agent_linux
master

搜索帮助