mac下使用su获得权限

在mac下使用su由于没有密码无法获得权限,以下是我自己试验得出的解决办法:

使用 passwd root 来修改密码:

我先用passwd root 命令进行密码修改,过程如下:

passwd root
Changing password for root.
Old Password:
New Password:
Retype New Password:
passwd: authentication token failure

以上命令是我一路回车下来的,过程中得Old Password New Password Retype New Password都没有输入任何字符,直接回车的,最后一行提示:认证token失败。


接下来,使用 sudo passwd root 回车得到:

sudo passwd root

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:

在Password:行我输入了我想要设置的密码,比如:111111 回车

Changing password for root.
New password:
Retype new password:

这两个输入的也是之前的想要设置的密码 比如:111111回车

然后,命令行就回到了 :~ ,然后输入 su 回车

Password: 输入新的密码 111111 回车

sh-3.2#

使用root完毕,用exit退出即可


到这里,我们的su就获得了权限,恭喜以下自己吧。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值