zoukankan      html  css  js  c++  java
  • busybox之修改登录用户名和密码

    修改用户名涉及到2个文件 /etc/passwd /etc/shadow

    比如将默认的密码root:root改为 Root:abcd

    1.修改/etc/passwd

    Root:x:0:0:root:/root:/bin/sh

    2.修改 /etc/shadow如下

    Root:nN7ALIDilSRE6:12086::99999::::

    由前一个文章中提到,passwd和shadow文件的格式。其中shadow的保存的密码是密文形式,所以修改完用户名之后,需要想办法获取到密码的密文形式。

    3.修改busybox

    busybox1.01libbbcorrect_password.c中添加打印将密码密文打印出来,在回写到shadow文件中。

    correct_password函数中添加如下红色部分打印信息。这样在串口输入密码“zzzzzzzz”的时候,通过密码转换的密文将会被打印出来。将encrypted所打印出的值,拷到/etc/shadow绿色位置即可。

    。。。

    unencrypted = bb_askpass ( 0, "Password: " );

    if ( !unencrypted )

    {

    return 0;

    }

    encrypted = crypt ( unencrypted, correct );

    printf("test :  encrypted is  %s    ,unencrypted  is %s    ,correct is  %s ",encrypted, unencrypted, correct );

    memset ( unencrypted, 0, bb_strlen ( unencrypted ));

    return ( strcmp ( encrypted, correct ) == 0 ) ? 1 : 0;

  • 相关阅读:
    编码问题,编码到吐血
    dz验证码
    奇葩之mysql【四】找不到表了
    EntityFramework 使用Mysql数据库
    Create a custom output cache prodiver in asp.net4
    WPF一个很炫的控件
    yield grammar
    最大公约数的故事
    新人
    学习笔记 简单的amob A%B Problem
  • 原文地址:https://www.cnblogs.com/wangf/p/8178736.html
Copyright © 2011-2022 走看看