내 컴퓨터에 여러 사람이 로그인 한 경우 컴퓨터를 종료 할 때 Ubuntu에 수퍼 유저 인증이 필요합니다. 암호를 묻지 않고 컴퓨터를 종료 할 수 있도록하려면 어떻게해야합니까?
내 컴퓨터에 여러 사람이 로그인 한 경우 컴퓨터를 종료 할 때 Ubuntu에 수퍼 유저 인증이 필요합니다. 암호를 묻지 않고 컴퓨터를 종료 할 수 있도록하려면 어떻게해야합니까?
답변:
해결 방법이 필요하지 않습니다. 여러 사용자가 로그인 한 경우 시스템 종료 및 재부팅을위한 관리자 인증없이 종료 할 수 있도록 정책을 변경하면됩니다.
자주 사용하는 텍스트 편집기를 사용하여 /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy 파일을 편집하십시오. 루트 권한이 필요합니다.
다른 사람이 로그인 할 때 종료와 관련된 섹션 변경
<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>auth_admin_keep</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>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>auth_admin_keep</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>
여러 사용자가 로그인 한 경우 PC를 종료하고 재부팅 할 수 있습니다. 원하는지 여부는 다른 질문입니다.
Richard Holloway의 답변 은 실제로 PolickKit 인증이 부여되는 방식이 아닙니다. 아래 /usr/share/polkit-1/actions에 설치된 파일 은 수정하지 않습니다. 대신에서 아래의 권한을 수정해야합니다 /etc/polkit-1/localauthority/50-local.d/.
이 질문에 대한 방법은 다음과 같습니다.
다음과 같이 이름이 지정된 파일을 작성 /etc/polkit-1/localauthority/50-local.d/allow_all_users_to_shutdown.pkla하고 편집하십시오 sudoedit.
[Allow all users to shutdown]
Identity=unix-user:*
Action=org.freedesktop.consolekit.system.stop-multiple-users
ResultInactive=no
ResultActive=yes
그런 다음 .pkla동일한 디렉토리에 다른 파일을 작성 하십시오. .pkla예를 들어로 끝나는 이름을 사용 allow_all_users_to_restart.pkla하고 다음 내용으로 채우십시오.
[Allow all users to restart]
Identity=unix-user:*
Action=org.freedesktop.consolekit.system.restart-multiple-users
ResultInactive=no
ResultActive=yes
/var/lib/polkit-1/localauthority/50-local.d외에도 ResultAny=yes파일이 있어야하고 두 파일 모두에 추가 줄 이 필요했습니다. 내가 얻는 유일한 경고 메시지는 Failed to set wall message, ignoring: Interactive authentication required.이지만 종료하고 다시 시작하면 이제 올바르게 작동합니다.
sysctl poweroff -i해야합니다 org.freedesktop.login1.power-off-multiple-sessions, 그래서를 제외하고 같은 라인에 별도의 파일을 만든Action=org.freedesktop.login1.power-off-multiple-sessions
더 좋은 방법이 있습니다. dbus-send를 설치 한 경우 루트 권한으로 에스컬레이션하지 않고도 dbus 를 통해 종료 할 수 있습니다 .
문서가있는 페이지를 기억할 수 없지만 한 명의 Archlinux 사용자가 이것을 알아 냈습니다.
일시 휴업:
dbus-send --system --print-reply --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown
재부팅 :
dbus-send --system --print-reply --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Reboot
매달다, 중지하다, 뜨게하다:
dbus-send --system --print-reply --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:1
최대 절전 모드 :
dbus-send --system --print-reply --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate
문안 인사.
HAL은 이제 폐기되어 최신 Ubuntu 릴리스에 설치되지 않은 것 같습니다.
전원 상태를 관리 하려면 ConsoleKit 및 UPower dbus 서비스를 사용해야합니다
일시 휴업:
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
재시작:
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
매달다, 중지하다, 뜨게하다:
dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
최대 절전 모드 :
dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
Arch Linux 포럼에 감사합니다 .
이것은 현재 Precise와 Quantal에서 작동하지만 Freedesktop 포커스가 ConsoleKit에서 systemd로 이동 한 이후 얼마나 오래 지속되는지는 모릅니다. 정식적인 관심이 있는지 모르겠다 ...
이것은 14.04에서 작동합니다. Flimm 의 이전 IMO 정답 의 업데이트 된 변형입니다 .
sudo mkdir -p /etc/polkit-1/localauthority/50-local.d
sudoedit /etc/polkit-1/localauthority/50-local.d/allow_all_users_to_shutdown_reboot_suspend.pkla
이것을 안에 붙여 넣으십시오.
[Allow all users to shutdown]
Identity=unix-user:*
Action=org.freedesktop.login1.power-off-multiple-sessions
ResultActive=yes
[Allow all users to reboot]
Identity=unix-user:*
Action=org.freedesktop.login1.reboot-multiple-sessions
ResultActive=yes
[Allow all users to suspend]
Identity=unix-user:*
Action=org.freedesktop.login1.suspend-multiple-sessions
ResultActive=yes
[Allow all users to ignore inhibit of shutdown]
Identity=unix-user:*
Action=org.freedesktop.login1.power-off-ignore-inhibit
ResultActive=yes
[Allow all users to ignore inhibit of reboot]
Identity=unix-user:*
Action=org.freedesktop.login1.reboot-ignore-inhibit
ResultActive=yes
[Allow all users to ignore inhibit of suspend]
Identity=unix-user:*
Action=org.freedesktop.login1.suspend-ignore-inhibit
ResultActive=yes
다른 사용자가 터미널 창을 열고 reboot명령을 루트로 실행하지 않고 로그인하는 동안 재부팅 할 때 수퍼 유저 비밀번호를 묻는 프롬프트를 피할 수있는 방법이 없습니다 .
sudo reboot
그럼에도 불구하고 사용자 계정의 암호 프롬프트를 무시하도록 구성되지 않은 경우 암호를 묻는 메시지 sudo도 표시됩니다.
걱정하지 마십시오. 이것들은 좋은 것입니다. 재부팅은 드물고 간단한 관리자 암호 프롬프트로 실수로 자신을 호소합니다!
이 작업을 수행 할 그룹 / 사용자에게 할당 된 sudoers 파일에 중지 및 / 또는 재부팅을 추가하십시오. 이렇게하면 시스템에 대한 전체 루트 액세스 권한을 부여하지 않고도 종료 할 수있는 사람을 계속 제어 할 수 있습니다.
http://linux.byexamples.com/archives/315/how-to-shutdown-and-reboot-without-sudo-password/
gdm이 루트로 실행되기 때문에 GUI에서 루트없이 종료 할 수 있습니다. Gnome은 gdm에게 종료하도록 지시하고 gdm은 종료합니다.
스크립트로 비슷한 것을 할 수 있습니다. BASH를 사용하는 것이 얼마나 편리한 지 잘 모르겠지만 루트로 실행되고 특정 신호를 수신하면 shutdown 명령을 실행하는 스크립트를 작성할 수 있다고 생각합니다.
보안 문제가 발생할 수 있습니다.