“无法执行命令:权限被拒绝” Ubuntu 18.04.3 LTS

时间:2019-10-18 20:13:32

标签: linux permissions command ubuntu-18.04 denied

尝试在运行Ubuntu(版本18.04.3 LTS,64位)的旧HP ProLiant上为Ark设置游戏服务器。规格是72GB RAM,2.67 GHz x2的Intel Xeon X5650。我一直在学习Ubuntu,所以我几乎不知道自己在做什么,意识到我可能会犯一些愚蠢的错误……但是我完全迷失了。感谢Google,我设法完成了很多工作,但即使Google似乎也无法再帮助我。

我一直在使用多个指南来帮助我进行设置。

  1. https://ark.gamepedia.com/Dedicated_Server_Setup#Linux_.28via_systemd.29
  2. http://arksurvivalevolved.gamewalkthrough-universe.com/dedicatedservers/linux/Default.aspx
  3. https://survivetheark.com/index.php?/forums/topic/87419-guide-cluster-setup/

我已经多次浏览了这些指南中的每个步骤,并且至少设法达到了我被卡在“权限被拒绝”错误的位置。

我已经尝试过此Google搜索下提供的所有解决方案:https://www.google.com/search?q=linux+%22failed+to+execute+command%3A+permission+denied%22

另外,我尝试执行命令以使用“ sudo”和不使用“ sudo”来启动服务器。

我的猜测是,由于某种原因,它试图访问的文件是不允许的,但是我似乎找不到适合我的解决方案。

[Unit]
Description=ARK: Survival Evolved dedicated server
Wants=network-online.target
After=syslog.target network.target nss-lookup.target network-online.target

[Service]
ExecStartPre=/home/kinare/steamcmd +login anonymous +force_install_dir /home/kinare/ark +app_update 376030
ExecStart=/home/kinare/ark/ShooterGame/Binaries/Linux/ShooterGameServer.exe Ragnarok?SessionName="Togerland - PVE Ragnarok"?AltSaveDirectoryName=RagSave?Port=7777?QueryPort=27015 -NoTransferFromFiltering -exclusivejoin -clusterid=Togerland
ShooterGameServer.exe Aberration_P?SessionName="Togerland - PVE Aberration"?AltSaveDirectoryName=AbSave?Port=7779?QueryPort=27017 -NoTransferFromFiltering -exclusivejoin -clusterid=Togerland
WorkingDirectory=/home/kinare/ark/ShooterGame/Binaries/Linux
LimitNOFILE=500000
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s INT $MAINPID
User=steam
Group=steam

[Install]
WantedBy=multi-user.target

仅包括集群中6个地图中的2个,以节省空间,希望就足够了。

预期结果应该是它不会启动失败...错误消息:

ark-dedicated.service - ARK: Survival Evolved dedicated server
Loaded: loaded (/etc/systemd/system/ark-dedicated.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-10-18 15:35:19 EDT; 56s ago
Process: 6383 ExecStartPre=/home/kinare/steamcmd +login anonymous +force_install_dir /home/kinare/ark +app_update 376030 (code=exited, status=203/EXEC)

Oct 18 15:35:19 togerland-server systemd[1]: Starting ARK: Survival Evolved dedicated server...
Oct 18 15:35:19 togerland-server systemd[6383]: ark-dedicated.service: Failed to execute command: Permission denied
Oct 18 15:35:19 togerland-server systemd[6383]: ark-dedicated.service: Failed at step EXEC spawning /home/kinare/steamcmd: Permission denied
Oct 18 15:35:19 togerland-server systemd[1]: ark-dedicated.service: Control process exited, code=exited status=203
Oct 18 15:35:19 togerland-server systemd[1]: ark-dedicated.service: Failed with result 'exit-code'.
Oct 18 15:35:19 togerland-server systemd[1]: Failed to start ARK: Survival Evolved dedicated server.

1 个答案:

答案 0 :(得分:1)

您的系统服务使用 user group steam

...
User=steam
Group=steam
...

您是从 kinare

的家中启动方舟服务器的
ExecStart=/home/kinare/ark/ShooterGame/Binaries...

,并且您的系统日志中显示:“权限被拒绝”:

Oct 18 15:35:19 togerland-server systemd[6383]: ark-dedicated.service: Failed to execute command: Permission denied

steam 用户是否有权读取/home/kinare中的文件?

您可以通过以下几种方法解决此问题:

  • 授予Steam用户权限以读取/home/kinare

    # change the group of all files and dirs in /home/kinare to steam
    chgrp -R steam /home/kinare
    # give the group read rights on all files and dirs /home/kinare
    chmod -R g+r /home/kinare
    # allow the group to open folders under /home/kinare
    find /home/kinare -type d -exec chmod 750 {} \;
    
  • 使用服务帐户

    将方舟和蒸汽移至蒸汽用户(/ home / steam)的家中并进行更换 您的单位文件根据需要。请记住,您需要更改以下用户的权限 / home / steam中的文件。这是首选,您可以使用服务帐户 您的管理员用户kinare

  • 更改系统服务文件中使用的用户和组

    User=kinare
    Group=kinare
    

    ark现在将以用户的亲属身份运行。此方法次之,请参阅: https://unix.stackexchange.com/questions/314725/what-is-the-difference-between-user-and-service-account

    希望这会有所帮助,祝你好运