树莓派启用root账户

树莓派root账户默认设置是没有密码,且账户是锁定的,开启root账户首先要设置密码。

sudo passwd root

设置密码后要解除root账户锁定状态。

pi@raspberrypi:~ $ sudo passwd --unlock root
passwd: password expiry information changed.

如果上面执行完出现”password expiry information changed.“的提示

是因为新版本ssh默认关闭root登陆,可以修改一下ssh的配置文件

sudo nano /etc/ssh/sshd_config

【Ctrl+W】快捷键,搜索【PermitRootLogin without-password】,修改【PermitRootLogin without-password】为【PermitRootLogin yes】。

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
PermitRootLogin yes
UsePAM yes

【Ctrl+O】快捷键,保存。
再按一次回车,然后【Ctrl+X】快捷键退出。

至此可以切换到root账户了

su root

可以使用以下命令切回普通用户

su pi

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值