1 Star 0 Fork 52

Loodd / kasini3000

forked from chuanjiao10 / kasini3000 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
gx更新主控机ssh秘钥1.ps1 1.98 KB
一键复制 编辑 原始数据 按行查看 历史
#建议保存编码为:bom头 + utf8
#判断有秘钥1后,移动到秘钥3。重生成秘钥1。
if ( ($IsWindows -eq $True) -or ($PSVersionTable.psversion.major -lt 6) ) #win
{
& 'c:\ProgramData\kasini3000\0k_source.ps1'
}
if ($IsLinux -eq $True)
{
& '/etc/kasini3000/0k_source.ps1'
}
if ( ($IsWindows -eq $True) -or ($PSVersionTable.psversion.major -lt 6) ) #win
{
if (Test-Path -LiteralPath "$env:USERPROFILE\.ssh\id_rsa")
{
if (Test-Path -LiteralPath "${global:kasini3000_data_path}\ssh_key_files_old2")
{
Remove-Item -Path "${global:kasini3000_data_path}\ssh_key_files_old2\*"
}
else
{
Write-Warning "警告,找不到旧2密钥路径,将建立它"
mkdir -Name "${global:kasini3000_data_path}\ssh_key_files_old2"
}
Move-Item -Force -LiteralPath "$env:USERPROFILE\.ssh\id_rsa" -Destination "${global:kasini3000_data_path}\ssh_key_files_old2"
Move-Item -Force -LiteralPath "$env:USERPROFILE\.ssh\id_rsa.pub" -Destination "${global:kasini3000_data_path}\ssh_key_files_old2"
& 'chmod700win.ps1' "${global:kasini3000_data_path}\ssh_key_files_old1\id_rsa"
& 'jl建立主控机ssh秘钥1z.ps1'
}
else
{
& 'jl建立主控机ssh秘钥1z.ps1'
}
}
if ($IsLinux -eq $True)
{
if (Test-Path -LiteralPath '/root/.ssh/id_rsa')
{
if (Test-Path -LiteralPath '/root/kasini3000/ssh_key_files_old2/')
{
Remove-Item -Path '/root/kasini3000/ssh_key_files_old2/*'
}
else
{
Write-Warning "警告,找不到旧2密钥路径,将建立它"
mkdir -Name '/root/kasini3000/ssh_key_files_old2/'
}
Move-Item -Force -LiteralPath '/root/.ssh/id_rsa' -Destination '/root/kasini3000/ssh_key_files_old2/'
Move-Item -Force -LiteralPath '/root/.ssh/id_rsa.pub' -Destination '/root/kasini3000/ssh_key_files_old2/'
& 'jl建立主控机ssh秘钥1z.ps1'
}
else
{
& 'jl建立主控机ssh秘钥1z.ps1'
}
chmod 600 /root/.ssh/id_rsa
chmod 600 /root/.ssh/id_rsa.pub
chmod 600 /root/kasini3000/ssh_key_files_old2/*
chmod 600 /root/kasini3000/ssh_key_files_old1/*
}
exit 0
PowerShell
1
https://gitee.com/lucky99/kasini3000.git
git@gitee.com:lucky99/kasini3000.git
lucky99
kasini3000
kasini3000
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891