ブラウザをrootとして実行

ブラウザをrootとして実行

ブラウザをrootとして実行する必要があります。シトリックス受信機、ブラウザで実行すると、hostsファイルにアクセスして編集する権限を付与します。

それ以外の場合は、次のエラーが発生します。

ホストファイルを変更する権限がありません。 / etcディレクトリへの書き込み権限があることを確認してください。

明らかにCitrixにはアクセスが必要であり、hosts私が知っている限り、唯一の方法はFirefoxをrootとして実行することです。

sudo firefox

ブラウザをrootとして実行するとセキュリティ上の問題はありますか?

hostsFirefoxをrootとして実行する必要がないように、このファイルを永久に編集可能にする方法はありますか?

アップデート1

mikeservの提案に従って私は実行しました。

cp /etc/hosts /tmp
sudo unshare -m sh -c '
    mount -B /tmp/hosts /etc/hosts
    exec runuser -u '"$USER"' firefox'

新しく開いたFirefoxインスタンスでCitrixを使用してリソースにアクセスしようとしましたが、上記と同じエラーが発生しました。
また、端末に次のエラーダンプが表示されます。

1449062781808   addons.xpi  WARN    Can't iterate directory /home/user/.mozilla/firefox/2vytc6tm.default/extensions: [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFile.directoryEntries]"  nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)"  location: "JS frame :: resource://gre/modules/addons/XPIProvider.jsm :: getDirectoryEntries :: line 1713"  data: no] Stack trace: getDirectoryEntries()@resource://gre/modules/addons/XPIProvider.jsm:1713 < DirInstallLocation__readAddons()@resource://gre/modules/addons/XPIProvider.jsm:7502 < DirectoryInstallLocation()@resource://gre/modules/addons/XPIProvider.jsm:7441 < addDirectoryInstallLocation()@resource://gre/modules/addons/XPIProvider.jsm:2298 < XPI_startup()@resource://gre/modules/addons/XPIProvider.jsm:2347 < callProvider()@resource://gre/modules/AddonManager.jsm:221 < _startProvider()@resource://gre/modules/AddonManager.jsm:828 < AMI_startup()@resource://gre/modules/AddonManager.jsm:999 < AMP_startup()@resource://gre/modules/AddonManager.jsm:2672 < AMC_observe()@resource://gre/components/addonManager.js:58 < <file:unknown>

(firefox:7994): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Failed to connect to socket /tmp/dbus-9dyvIdS0jP: Verbindungsaufbau abgelehnt

(firefox:7994): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Failed to connect to socket /tmp/dbus-CBkXMgnC2r: Verbindungsaufbau abgelehnt

(firefox:7994): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Verbindung ist gescheitert: Verbindungsaufbau abgelehnt

(firefox:7994): dconf-CRITICAL **: unable to create file '/home/user/.cache/dconf/user': Keine Berechtigung.  dconf will not work properly.

(firefox:7994): dconf-CRITICAL **: unable to create file '/home/user/.cache/dconf/user': Keine Berechtigung.  dconf will not work properly.

...

(firefox:7994): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Failed to connect to socket /tmp/dbus-dMG4PGVMeg: Verbindungsaufbau abgelehnt

(firefox:7994): dconf-CRITICAL **: unable to create file '/home/user/.cache/dconf/user': Keine Berechtigung.  dconf will not work properly.

(firefox:7994): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Failed to connect to socket /tmp/dbus-jIIyll6Cjh: Verbindungsaufbau abgelehnt

...

アップデート2

JVMLauncher.afterStart(): starting JVM process watcher

(wfica:4510): GLib-CRITICAL **: Source ID 75 was not found when attempting to remove it

(wfica:4510): GLib-CRITICAL **: Source ID 127 was not found when attempting to remove it

ベストアンサー1

Linuxmountネームスペースを使用すると同じ効果に近づきますが、責任ははるかに減ります。

cp /etc/hosts /tmp
sudo -E unshare -m sh -c '
    mount -B /tmp/hosts /etc/hosts
    runuser -p '"$USER"' -c firefox'

おすすめ記事