실행되고 있지 않은 경우 .profile에서 GUI를 시작하시겠습니까? 리눅스 민트 19

실행되고 있지 않은 경우 .profile에서 GUI를 시작하시겠습니까? 리눅스 민트 19

내 .profile 파일에 다음 스크립트가 있습니다.

systemctl is-active --quiet lightdm && (
    echo Welcome to Terminal) || (
    sleep 8
    startx)
fi

목표는 GUI가 아직 실행되지 않은 경우 GUI를 시작하는 것입니다. 그러나 결코 그렇지 않습니다. 터미널에 오신 것을 환영합니다라고 표시되지도 않습니다.

편집: /etc/sudoers에 규칙을 추가하려고 시도했지만 프롬프트가 변경되지 않습니다. 파일에 있는 내용은 다음과 같습니다.

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults    env_reset
Defaults    mail_badpass
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification
lukaka  ALL = NOPASSWD: /usr/sbin/service lightdm *
# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

답변1

끝에 추가~/.profile파일:

systemctl is-active --quiet lightdm && {
    echo 'Welcome to Terminal'
} || {
  echo 'Starting Desktop GUI in 8 seconds... Press Ctrl-c to abort'
    sleep 8
    sudo systemctl start lightdm
}

LinuxMint가 데스크톱 대신 콘솔로 부팅하도록 설정되어 있으면 계정에 로그인하면 다음 메시지가 표시됩니다.

8초 안에 데스크탑 GUI 시작 중... 중단하려면 Ctrl-c를 누르세요

데스크탑 로딩을 중단하려면 - 누르십시오. Ctrl+c 그렇지 않으면 시스템이 비밀번호를 입력하라는 메시지를 표시합니다. 인증을 통과하면 데스크탑 GUI가 시작됩니다.

이미 데스크톱을 로드하고 터미널 프로그램을 시작하면 환영 메시지가 표시됩니다.

터미널에 오신 것을 환영합니다

추신

sudo자동 데스크탑 시작에 비밀번호를 제공하지 않으려면 다음을 수행하십시오.

1. 실행 sudo visudo하고 비밀번호를 입력하세요.

sudo2. 어디에서나 비밀번호를 입력하는 데 방해가 되지 않으려면
파일 끝에 다음을 추가하세요. (대신 실제 사용자 이름으로 대체하세요.귀하의 사용자 이름)
YourUserName ALL=(ALL) NOPASSWD: ALL그리고 저장하세요. 그렇지 않으면 다음 줄을 사용하여 데스크톱을 시작할 때만 비밀번호를
입력하라는 요구 사항을 무시할 수 있습니다 .sudovisudo
YourUserName ALL = NOPASSWD: /usr/sbin/service lightdm *

관련 정보