한 세션을 종료하려면 sudo 비밀번호가 필요합니다.

한 세션을 종료하려면 sudo 비밀번호가 필요합니다.

여러 사람이 사용하는 Ubuntu를 실행하는 컴퓨터가 있습니다. 전원을 끄는 데 많은 시간이 소요됩니다. 때때로 Wake-On-Lan을 사용하여 시작하고 SSH를 통해 연결하고 백그라운드에서 작업을 시작하고 싶습니다. 이 작업이 실행되는 동안 PC가 종료되는 것을 원하지 않습니다.

하지만 이 PC를 사용할 수 있는 사람이 여러 명이기 때문에 누군가가 컴퓨터로 다가가서 로그인하고 이메일 등을 확인한 다음 PC를 종료할 수 있습니다. 또는 누군가가 켜져 있고 GDM 로그인 화면을 표시하는 것을 알아차리고 종료하기로 결정할 수도 있습니다.

이런 일이 발생하지 않도록 하는 방법이 있나요? 완전히 불가능하게 만들 필요는 없습니다. "정말로 확실합니까(작업이 백그라운드에서 실행 중입니까?)?"라는 창이 팝업으로 컴퓨터에 표시되도록 하기만 하면 됩니다. 완벽하게 잘 할 것입니다. 그러나 로그인 후 Gnome 메뉴와 GDM 화면 모두에서 작동해야 합니다.

답변1

GDM과 로그인 시 메뉴에서 모두 비활성화할 수 있습니다.

편집 /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy하고 거기에 적힌 대로

<allow_active>yes</allow_active>

그걸로 바꾸세요

<allow_active>auth_admin_keep</allow_active>

따라서 파일은 다음과 같습니다.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">

<!--
Policy definitions for ConsoleKit
-->

<policyconfig>

  <action id="org.freedesktop.consolekit.system.stop">
    <description>Stop the system</description>
    <message>System policy prevents stopping the system</message>
    <defaults>
      <allow_inactive>no</allow_inactive>
      <allow_active>no</allow_active>
    </defaults>
  </action>

  <action id="org.freedesktop.consolekit.system.stop-multiple-users">
    <description>Stop the system when multiple users are logged in</description>
    <message>System policy prevents stopping the system when other users are logged in</message>
    <defaults>
      <allow_inactive>no</allow_inactive>
      <allow_active>no</allow_active>
    </defaults>
  </action>

  <action id="org.freedesktop.consolekit.system.restart">
    <description>Restart the system</description>
    <message>System policy prevents restarting the system</message>
    <defaults>
      <allow_inactive>no</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
  </action>

  <action id="org.freedesktop.consolekit.system.restart-multiple-users">
    <description>Restart the system when multiple users are logged in</description>
    <message>System policy prevents restarting the system when other users are logged in</message>
    <defaults>
      <allow_inactive>no</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
  </action>

</policyconfig>

메모:당신은하지 않습니다가지다마지막 두 섹션을 변경하려면(재시작에 영향을 미칩니다), 하지만 누군가가 컴퓨터를 종료하는 것을 원하지 않는다면 컴퓨터를 다시 시작하는 것도 원하지 않을 것이라고 가정합니다.

이 작업을 더 빠르게 수행하려면 이 파일의 두 가지 버전을 만들 수 있습니다.(일반 사용자가 컴퓨터를 종료할 수 있는 것과 그렇지 않은 것)홈 디렉토리 어딘가에 그 중 하나를 복사하는 스크립트가 있습니다 /usr/share/polkit-1/actions/.

답변2

gdm의 경우 시스템 제어를 비활성화하는 방법이 있다고 생각하지만 방법을 모르겠습니다. gnome의 경우 "gksudo Halt" 명령을 사용하여 실행기를 만들 수 있습니다. 컴퓨터를 종료하려면 비밀번호를 묻습니다.

관련 정보