云计算:破解root用户密码

破解root用户密码

1.重启

2.选择内核

3.输入e,编辑内核

4.找到Linux16开头的行,在这一行的最后添加 init=/bin/bash        或者添加rd.break  cinsole=tty0

5.Ctrl+x保存

6.重新挂载根分区   mount  -o  remount,rw  /

或者

        mount  -o  remount,rw /sysroot

        chroot  /sysroot

7.检查selinux是否开启

        如果开启:

                        touch /.autorelabel

                        passwd

                        exec  /sbin/init

                        或者

                        exit

                        exec  /sbin/init

        如果关闭:

                        passwd

                        exec  /sbin/init

                        或者

                        exit

                        exec  /sbin/init

这儿只试了一种方法,其余自己尝试。

CENTOS7下google身份验证器安装

1、同步时钟

root@newrain:# timedatectl set-timezone Asia/Shanghai # 调整时区
root@newrain:# ntpdate ntp.aliyun.com #进行对时
20 Jan 15:09:24 ntpdate[17021]: adjust time server * offset -0.006584

2、安装谷歌验证器

root@newrain:# yum install -y git automake libtool pam-devel bzip2 wget
root@newrain:# wget http://repository.timesys.com/buildsources/l/libpam-google-authenticator/libpam-google-authenticator-1.0/libpam-google-authenticator-1.0-source.tar.bz2
root@newrain:# tar -jxvf libpam-google-authenticator-1.0-source.tar.bz2 && cd libpam-google-authenticator-1.0 && make && make install

3、运行谷歌程序

root@newrain:# google-authenticator # 运行


Do you want authentication tokens to be time-based y
您希望认证令牌是基于时间的吗? 是的
Do you want me to update your "/root/.google_authenticator" file
你想让我更新你的“/root /.GoGoLoEuthigor”文件吗?
Do you want to disallow multiple uses of the same authentication
token? This restricts you to one login about every 30s, but it increases
your chances to notice or even prevent man-in-the-middle attacks y
是否拒绝使用相同身份验证的多个用途令牌?这限制了你每30秒的一次登录,但是它增加了。你注意到或者甚至阻止中间人攻击的机会 y
By default, tokens are good for 30 seconds and in order to compensate for
possible time-skew between the client and the server, we allow an extra
token before and after the current time. If you experience problems with poor
time synchronization, you can increase the window from its default
size of 1:30min to about 4min. Do you want to do so (y/n) n
默认情况下,令牌是刚好的30秒,然后更新。客户机和服务器之间可能出现时间偏差,我们允许额外的在当前时间之前和之后的令牌。如果你遇到麻烦的问题时间同步,可以从默认窗口中增加窗口尺寸为1:30min至约4min。您想这样做(Y/N)吗? n
If the computer that you are logging into isn't hardened against brute-force
login attempts, you can enable rate-limiting for the authentication module.
By default, this limits attackers to no more than 3 login attempts every 30s.
Do you want to enable rate-limiting (y/n) y
如果你正在登录的计算机没有被暴力攻击
登录尝试,您可以为验证模块启用速率限制。
默认情况下,这将限制攻击者每30秒不超过3次登录尝试。
是否要启用速率限制(是/否)

4、配置ssh登录

root@newrain:# systemctl restart sshd
设置 pam.d/sshd
执行下面命令
root@newrain:# echo "auth required pam_google_authenticator.so" >> /etc/pam.d/sshd
设置 sshd
root@newrain:# vim /etc/ssh/sshd_config
# 修改
ChallengeResponseAuthentication yes

 

手机下载google身份验证器
安卓:下载任意google身份验证器,以及一个斑马线条码扫描器
Ios: 自行appstore下载
创建账户
上文中google-authenticator 执行完之后会给出一个二维码以及

可以直接扫描二维码或者在账户管理中添加 secret key
下面的5组8位数字是紧急登录秘钥,记住其中一组在手机不在身边时可以紧急登录

  • 11
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值