UART 콘솔에서 자동 로그인을 비활성화하는 방법

UART 콘솔에서 자동 로그인을 비활성화하는 방법

우리는 임베디드 Linux: 4.1.22-ltsi, "Debian GNU/Linux 9 (stretch)" 카드를 사용합니다.

Uart 콘솔에서 프로세스를 시작한 후 자동으로 로그인하고 프롬프트를 표시합니다.

root@linaro-developer:
root@linaro-developer: who am i
root ttyS0 2016-11-03 17:16

질문:

카드에 대한 보안 연결을 허용하기 위해 자동 로그인을 비활성화하려면 Linux 구성을 어떻게 변경합니까?

아래의 /etc/inittab 파일을 참조하세요.

# /etc/inittab
#
# Copyright (C) 2001 Erik Andersen <[email protected]>
#
# Note: BusyBox init doesn't support runlevels.  The runlevels field is
# completely ignored by BusyBox init. If you want runlevels, use
# sysvinit.
#
# Format for each entry: <id>:<runlevels>:<action>:<process>
#
# id        == tty to run on, or empty for /dev/console
# runlevels == ignored
# action    == one of sysinit, respawn, askfirst, wait, and once
# process   == program to run

# Startup the system
null::sysinit:/bin/mount -t proc proc /proc
null::sysinit:/bin/mount -o remount,rw /
null::sysinit:/bin/mkdir -p /dev/pts
null::sysinit:/bin/mkdir -p /dev/shm
null::sysinit:/bin/mount -a
null::sysinit:/bin/hostname -F /etc/hostname
# now run any rc scripts
::sysinit:/etc/init.d/rcS

# Do not ask for a password at boot
console::respawn:-/bin/sh
# Put a getty on the serial port
# console::respawn:/sbin/getty -L  console 115200 vt100 # GENERIC_SERIAL

# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot

# Stuff to do before rebooting
::shutdown:/etc/init.d/rcK
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r

@MC68020 게시물 이후에 편집하세요.

@MC68020의 제안에 따라 다음과 같이 변경했습니다.하지만 결과가 없습니다!

바꾸다

# Do not ask for a password at boot
console::respawn:-/bin/sh
# Put a getty on the serial port
# console::respawn:/sbin/getty -L  console 115200 vt100 # GENERIC_SERIAL

내가 설정

# Do not ask for a password at boot
# console::respawn:-/bin/sh
# Put a getty on the serial port
console::respawn:/sbin/getty -L  console 115200 vt100

답변1

이것/etc/inittab이 파일은 시작 시 및 정상 작동 중에 시작되는 프로세스와 방법을 설명합니다. 이 프로세스는 다음과 같이 구성됩니다.내부에터미널을 관리하려면게티그러면 주어진 명령의 매개변수에 따라 /bin/login 프로세스가 시작됩니다.

/etc/inittab을 보면 다음과 같은 내용을 읽을 수 있습니다.

s0:12345:respawn:/sbin/agetty -a root -L 115200 ttyS0 vt100

알아채다-ㅏ원하지 않는 자동 로그인 옵션을 활성화하세요터미널 S0. 그러니 그냥 삭제하세요(아래 사용자 이름과 함께).


OP의 inittab에 대한 자세한 정보를 얻은 후 편집하십시오.

console::respawn:-/bin/sh그 줄은 init에게 getty를 우회하고 콘솔에서 직접 쉘을 포크하도록 지시한다는 것을 알고 있습니다 . 그러니까...삭제하거나 댓글을 달아보세요.
대신 getty를 시작해야 하는 앞의 주석 기호를 삭제하고 로그인 프로세스도 삭제하세요.console::respawn:/sbin/getty -L console 115200 vt100 # GENERIC_SERIAL


그런데, 후회하는 것보다 안전합니다...변경하기 전에 유효한 사용자 이름/비밀번호 연결을 얻었는지 확인하세요...

관련 정보