sudo
#command #error
書き込みなどでsudoが必要だが、sudoがそのcommandのpathを知らない
-E env で 環境変数でPATHを指定して実行
$ sudo -E env "PATH=$PATH" jupyter ....
みたいにして 環境変数のPATHを一時的に変えて、対処
状況:
Jupyter notebook で、binaryは local userのpathにあるのだけど、installなどをするときの場所が、なぜか /usr だったり、root権限がいるものがある。 jupyterの upgrade の過程で方針を変えてきてる???
症状:
sudo jupyter.... sudo(root)では jupyterないよ
jupyter ... /usrにwrite権限ないので、permissoin error.
ニッチモサッチモ。
以下のコメントの説明から。
https://github.com/jupyter/docker-stacks/issues/524#issuecomment-371440373
sudo での hostname:
sudo: unable to resolve host "hostname" - Unix & Linux Stack Exchange
sudo uses the system resolver, configured by /etc/nsswitch.conf
/etc/hosts, /etc/hostnameではない..
To fix it, simply update /etc/hosts with the new hostname
でも、nsswitchは編集してはいけない?ので、hosts, hostnameを変える
linux - Why does my hostname appear with the address 127.0.1.1 rather than 127.0.0.1 in /etc/hosts? - Server Fault
127.0.1.1 と 127.0.0.1の違いは、
...ちょっtよくわからない。1.1.の方は、/etc/hostsとは独立して...??
ファイルのtimestampを更新したら、 sudo echo $HOSTNAMEが答えるようになった。