내장 장치에서 루트 비밀번호 재설정 문제

내장 장치에서 루트 비밀번호 재설정 문제

Linux 임베디드 파일 시스템은 원시 NAND 플래시에서 완전히 실행되며 Full Image의 RootFS를 사용합니다. Linux v. 2.6.26.5, U-boot 2009.03 부트로더. 커널이 완전히 로드된 후 명령을 제출하려고 하면 장치에 콘솔 로그인 프롬프트가 표시됩니다. 따라서 장치의 루트 비밀번호를 재설정해야 합니다. 커널 부팅 매개변수 끝에 인수를 single추가 하여 U-boot로 이 작업을 수행해 보았습니다 .init=/bin/sh

setenv bootargs ${bootargs} single init=/bin/sh

그런 다음 루트 권한으로 Busybox 쉘 명령줄에 접속했습니다. 여기에서 passwd루트 비밀번호를 재설정하는 명령을 실행하려고 했습니다.

BusyBox v1.10.2 (2015-09-06 10:58:05 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: can't access tty; job control turned off
# help

Built-in commands:
-------------------
    . : [ [[ alias bg break cd chdir continue echo eval exec exit
    export false fg hash help jobs let local pwd read readonly return
    set shift source test times trap true type ulimit umask unalias
    unset wait

# passwd
passwd: unknown uid 0
# cd etc
# cat passwd
cat: can't open 'passwd': No such file or directory
# ls -l
...
lrwxrwxrwx    1 1014     1014           11 Oct 26  2015 passwd -> /tmp/passwd

루트 비밀번호를 재설정하는 방법은 무엇입니까?

편집: 로그에서

# df
Filesystem           1k-blocks      Used Available Use% Mounted on
df: /proc/mounts: No such file or directory


# cd dev
# ls -l
crw-r--r--    1 0        0          5,   1 Jan  1 00:05 console
crw-r--r--    1 0        0          2,   0 Oct 26  2015 nfs

답변1

당신은 비지박스 비상 쉘에 있고 실제 루트 파티션은 아직 마운트되지 않았습니다.

를 통해 사용 가능한 장치를 나열 ls /dev하고 를 통해 해당 루트 파티션을 마운트할 수 있습니다 mount /dev/<root_device> /<mount_point>.

passwd그런 다음 해당 마운트 지점에서 편집할 수 있습니다 .

관련 정보