LoginSignup
3
1

More than 5 years have passed since last update.

/etc/resolv.confにアクセス権がないとresolveできない

Posted at

同じマシンで、rootユーザーだとネットアクセスできるのに、一般ユーザーだとできなくなってて小一時間ハマり、historyしてみると以前にも同じとこでハマってた痕跡があったし、もうどう調べればいいのかもわからないので自分メモ

症状

# nslookup yahoo.co.jp
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   yahoo.co.jp
Address: 183.79.135.206
Name:   yahoo.co.jp
Address: 182.22.59.229
# su -l taro
$ nslookup yahoo.co.jp
;; connection timed out; trying next origin
;; connection timed out; n

rootだとできるのにtaroさんだとできない

原因?

# ls -al /etc/resolv.conf
-rw-------. 1 root root 38 Feb  4 13:55 /etc/resolv.conf

これが一般ユーザーから見えないから?

解決

# chmod +r /etc/resolv.conf
# su -l taro
$ nslookup yahoo.co.jp
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   yahoo.co.jp
Address: 183.79.135.206
Name:   yahoo.co.jp
Address: 182.22.59.229

できた・・
そもそもなんでいきなり権限変わるの・・

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1