一键获取最高root权限,自定义root密码!支持Euserv德鸡,Hax IPV6,甲骨文oracle、谷歌云gpc、亚马逊云azurz等VPS
代码如下
#!/bin/bash
green(){ echo -e "\033[32m\033[01m$1\033[0m" } [[ $EUID -ne 0 ]] && su='sudo' lsattr /etc/passwd /etc/shadow >/dev/null 2>&1 chattr -i /etc/passwd /etc/shadow >/dev/null 2>&1 chattr -a /etc/passwd /etc/shadow >/dev/null 2>&1 lsattr /etc/passwd /etc/shadow >/dev/null 2>&1 prl=`grep PermitRootLogin /etc/ssh/sshd_config` pa=`grep PasswordAuthentication /etc/ssh/sshd_config` if [[ -n $prl && -n $pa ]]; then read -p "自定义root密码:" mima echo root:$mima | $su chpasswd root $su sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config; $su sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config; $su service sshd restart green "VPS当前用户名:root" green "vps当前root密码:$mima" else red "当前vps不支持root账户或无法自定义root密码" && exit 1 fi
|
bash <(curl -sSL https://cdn.jsdelivr.net/gh/szsyzx/vps/root.sh)
|
用户名:root,密码必须自定义。
登录SSH时,请更改原用户名为root,并输入自定义密码!
提示:密码不要设置得过于简单,容易被破解。如有密钥文件要保存好,以防万一!