내 Kubuntu 컴퓨터에서 ProtonVPN이 자동으로 시작되도록 하려고 합니다.
내가 시도한 최신 것은 blog.x86txt.com에서였습니다. 그러나 다음 명령을 사용하는 경우:
systemctl enable protonvpn-cli.service && systemctl start protonvpn-cli.service
터미널에서 다음 메시지를 받았습니다.
Job for protonvpn-cli.service failed because the control process exited with error code.
See "systemctl status protonvpn-cli.service" and "journalctl -xe" for details.
내가 명령을 실행할 때
systemctl status protonvpn-cli.service
다음과 같은 결과가 나타납니다.
● protonvpn-cli.service - ProtonVPN CLI Auto-Start
Loaded: loaded (/etc/systemd/system/protonvpn-cli.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-01-13 11:19:20 CET; 13s ago
Process: 2177 ExecStart=/usr/bin/protonvpn-cli last-connect (code=exited, status=203/EXEC)
jan 13 11:19:20 teuton-VirtualBox systemd[2177]: protonvpn-cli.service: Failed at step EXEC spawning /usr/bin/protonvpn-cli
jan 13 11:19:20 teuton-VirtualBox systemd[1]: protonvpn-cli.service: Control process exited, code=exited status=203
jan 13 11:19:20 teuton-VirtualBox systemd[1]: protonvpn-cli.service: Failed with result 'exit-code'.
jan 13 11:19:20 teuton-VirtualBox systemd[1]: Failed to start ProtonVPN CLI Auto-Start.
jan 13 11:19:20 teuton-VirtualBox systemd[1]: protonvpn-cli.service: Service hold-off time over, scheduling restart.
jan 13 11:19:20 teuton-VirtualBox systemd[1]: protonvpn-cli.service: Scheduled restart job, restart counter is at 5.
jan 13 11:19:20 teuton-VirtualBox systemd[1]: Stopped ProtonVPN CLI Auto-Start.
jan 13 11:19:20 teuton-VirtualBox systemd[1]: protonvpn-cli.service: Start request repeated too quickly.
jan 13 11:19:20 teuton-VirtualBox systemd[1]: protonvpn-cli.service: Failed with result 'exit-code'.
jan 13 11:19:20 teuton-VirtualBox systemd[1]: Failed to start ProtonVPN CLI Auto-Start.
log file: -binfmt_misc.automount protonvpn-cli.service
Teuton은 사용자 이름입니다.
아래에 systemd 파일을 붙여넣겠습니다.
[Unit]
Description=ProtonVPN CLI Auto-Start
After=network.target
[Service]
Type=forking
User=teuton
ExecStart=/usr/bin/protonvpn-cli last-connect
ExecReload=/usr/bin/protonvpn-cli disconnect && /usr/bin/protonvpn-cli last-connect
ExecStop=/usr/bin/protonvpn-cli disconnect
Restart=always
[Install]
WantedBy=multi-user.target
--
여기에서는 명령 --last-connect
과 blog.x86txt.com에서 을 제거하여 --disconnect
어떤 식으로든 도움이 되는지 확인했습니다.
편집하다:
journalctl -xe
출력 은 다음 과 같습니다 .
-- Subject: Unit anacron.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit anacron.service has finished starting up.
--
-- The start-up result is RESULT.
jan 13 14:04:47 teuton-VirtualBox anacron[1883]: Anacron 2.3 started on 2020-01-13
jan 13 14:04:47 teuton-VirtualBox anacron[1883]: Normal exit (0 jobs run)
jan 13 14:17:01 teuton-VirtualBox CRON[1896]: pam_unix(cron:session): session opened for user root by (uid=0)
jan 13 14:17:01 teuton-VirtualBox CRON[1897]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
jan 13 14:17:01 teuton-VirtualBox CRON[1896]: pam_unix(cron:session): session closed for user root
jan 13 14:20:16 teuton-VirtualBox systemd[1]: Starting Message of the Day...
-- Subject: Unit motd-news.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit motd-news.service has begun starting up.
jan 13 14:20:16 teuton-VirtualBox systemd[1]: Started Message of the Day.
-- Subject: Unit motd-news.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit motd-news.service has finished starting up.
--
-- The start-up result is RESULT.
jan 13 15:05:08 teuton-VirtualBox systemd[1]: Started Run anacron jobs.
-- Subject: Unit anacron.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit anacron.service has finished starting up.
--
-- The start-up result is RESULT.
jan 13 15:05:08 teuton-VirtualBox anacron[1959]: Anacron 2.3 started on 2020-01-13
jan 13 15:05:08 teuton-VirtualBox anacron[1959]: Normal exit (0 jobs run)
jan 13 15:17:01 teuton-VirtualBox CRON[1969]: pam_unix(cron:session): session opened for user root by (uid=0)
jan 13 15:17:01 teuton-VirtualBox CRON[1970]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
jan 13 15:17:01 teuton-VirtualBox CRON[1969]: pam_unix(cron:session): session closed for user root
jan 13 15:24:32 teuton-VirtualBox sudo[1983]: teuton : TTY=pts/2 ; PWD=/etc/systemd/system ; USER=root ; COMMAND=/usr/sbin/visudo
jan 13 15:24:32 teuton-VirtualBox sudo[1983]: pam_unix(sudo:session): session opened for user root by teuton(uid=0)
jan 13 15:42:02 teuton-VirtualBox sudo[1983]: pam_unix(sudo:session): session closed for user root
teuton@teuton-VirtualBox:/etc/systemd/system$ sudo systemctl enable protonvpn-cli.service && systemctl start protonvpn-cli.service
[sudo] lösenord för teuton:
Job for protonvpn-cli.service failed because the control process exited with error code.
See "systemctl status protonvpn-cli.service" and "journalctl -xe" for details.
teuton@teuton-VirtualBox:/etc/systemd/system$ journalctl -xe
jan 13 15:42:25 teuton-VirtualBox systemd[2085]: protonvpn-cli.service: Failed at step USER spawning /usr/bin/protonvpn: No such process
-- Subject: Process /usr/bin/protonvpn could not be executed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The process /usr/bin/protonvpn could not be executed and failed.
--
-- The error number returned by this process is 3.
jan 13 15:42:25 teuton-VirtualBox systemd[1]: protonvpn-cli.service: Control process exited, code=exited status=217
jan 13 15:42:25 teuton-VirtualBox systemd[1]: protonvpn-cli.service: Failed with result 'exit-code'.
jan 13 15:42:25 teuton-VirtualBox systemd[1]: Failed to start ProtonVPN CLI Auto-Start.
-- Subject: Unit protonvpn-cli.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit protonvpn-cli.service has failed.
--
-- The result is RESULT.
jan 13 15:42:25 teuton-VirtualBox systemd[1]: protonvpn-cli.service: Service hold-off time over, scheduling restart.
jan 13 15:42:25 teuton-VirtualBox systemd[1]: protonvpn-cli.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit protonvpn-cli.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
jan 13 15:42:25 teuton-VirtualBox systemd[1]: Stopped ProtonVPN CLI Auto-Start.
-- Subject: Unit protonvpn-cli.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit protonvpn-cli.service has finished shutting down.
jan 13 15:42:25 teuton-VirtualBox systemd[1]: protonvpn-cli.service: Start request repeated too quickly.
jan 13 15:42:25 teuton-VirtualBox systemd[1]: protonvpn-cli.service: Failed with result 'exit-code'.
jan 13 15:42:25 teuton-VirtualBox systemd[1]: Failed to start ProtonVPN CLI Auto-Start.
-- Subject: Unit protonvpn-cli.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit protonvpn-cli.service has failed.
--
-- The result is RESULT.
lines 2394-2435/2435 (END)
편집 2: 이것은 내 sudo visudo
결과입니다.
#
# 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
# 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
teuton ALL = (root) NOPASSWD: /usr/local/bin/protonvpn
답변1
systemd 장치 구성의 경로 및 실행 파일이 sudoers.d 파일의 경로 및 실행 파일과 일치하지 않습니다.
파일 sudoers.d
에 언급된 내용 /usr/local/bin/protonvpn
(참고, local
이후 확장자 없음)은 ProtonVPN.com이 귀하의 질문에 나열된 지침에 명시한 내용과 내 컴퓨터에 있는 내용이기 때문에 제 생각에는 올바른 것 같습니다. (첫 번째 링크를 확인할 수 없습니다. 죽은 것 같습니다.)-cli
protonvpn
반면에 systemd 장치 설명에는 다음이 나열되어 있습니다 /usr/bin/protonvpn-cli
(없음 local
, -cli
확장됨).
ExecStart=/usr/bin/protonvpn-cli last-connect
ExecReload=/usr/bin/protonvpn-cli disconnect && /usr/bin/protonvpn-cli last-connect
ExecStop=/usr/bin/protonvpn-cli disconnect*
이 방향을 조사하게 된 계기는 다음과 같은 로그였습니다. systemd가 ExecStart에서 요청한 프로그램을 시작할 수 없는 것 같습니다.
Failed at step EXEC spawning /usr/bin/protonvpn-cli
그런 다음 오류가 직접 보고되었습니다.
which protonvpn
및 명령을 실행하여 컴퓨터의 올바른 경로와 실행 파일을 확인해야 합니다 which protonvpn-cli
. 나에게는 첫 번째 반환 경로인 /usr/local/bin/
.
이전 단계에서 결정된 올바른 파일과 경로로 sudoers.d 및 systemd 장치 구성을 업데이트합니다.
사이드 노트
sudoers.d 파일에서 더 구체적으로 설명하는 것이 좋습니다. 이제 사용자 권한만 있으면 VPN을 완전히 제어할 수 있습니다(VPN 끄기 또는 킬 스위치 비활성화 포함). 특정 명령에만 protonvpn connect
권한을 부여하는 것이 가장 좋습니다 protonvpn reconnect
(/usr/local/bin/protonvpn이 올바른 경로라고 가정).
teuton ALL = (root) NOPASSWD: /usr/local/bin/protonvpn connect,/usr/local/bin/protonvpn reconnect
그런 다음 시스템 장치 구성에서 다음을 수행하십시오.
ExecReload=
현재 가지고 있는 명령을 this 로 바꾸십시오/usr/local/bin/protonvpn reconnect
. 이 명령은 실제로 동일한 작업을 수행하지만disconnect
명령을 허용하지 않아도 된다는 장점이 있습니다.- 라인을 완전히 제거하십시오
ExecStop=/usr/bin/protonvpn-cli disconnect
. 이것은 필요하지 않습니다. (내 컴퓨터에 이 라인이 없었던 것처럼 VPN을 끄면 어쨌든 연결이 끊어집니다.)
이제 sudoers.d 파일에서 연결 해제 명령이 더 이상 필요하지 않으며 컴퓨터 보안이 향상되었습니다!