
我在名為 的使用者中安裝了 pm2 節點模組otheruser
。我需要從root
用戶運行該程式。
如果我正常登入otheruser
並執行任何操作,它工作正常。
otheruser@bubble-server:~$ /home/otheruser/.nvm/versions/node/v5.2.0/bin/pm2 list
● Agent online - public key: xxxxxxxx - machine name: server - Web access: https://app.keymetrics.io/
┌────────────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────┬───────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │
├────────────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────┼───────────┼──────────┤
│ │
└────────────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────┴───────────┴──────────┘
但是,如果我以 root 或其他使用者以外的任何其他使用者身分登錄,則它不起作用。
root@server:~# su -s /bin/bash -c "/home/otheruser/.nvm/versions/node/v5.2.0/bin/pm2 list" otheruser
root@server:~#
它在系統日誌中給出以下內容
server node[25227]: No AX.25 port data configured