wget can resolve addresses only when executed as super user

Asked by Rohit R on 2010-09-05

wget fails to resolve addresses when executed as user without administrative privileges.

strace -eopen wget www.google.com
returns this

1.when not su : http://paste.ubuntu.com/488636/

2.when su : http://paste.ubuntu.com/488637/

please help.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu wget Edit question
Assignee:
No assignee Edit question
Solved by:
Rohit R
Solved:
2010-09-16
Last query:
2010-09-16
Last reply:
2010-09-05

You are writing to /usr/lib/gconv/gconv-modules.cache which is not writable by users. If you run the command from your home folder, does it work ok?

Can you also give the output of:

ls -la /etc/resolv.conf

Thanks

Rohit R (rr0hit) said : #3

The output i posted is obtained when executed from home folder.So that does not seem to work.

ls -la /etc/resolv.conf returned

-rw-r--r-- 1 root root 30 2010-09-05 13:07 /etc/resolv.conf

ok the ls -la output matches mine so should be ok.

Seems this line is where the outputs change:

Resolving www.google.com... open("/etc/nsswitch.conf", O_RDONLY) = 3

What is the output of:

ls -la /etc/nsswitch.conf

Thanks

Rohit R (rr0hit) said : #5

ls -la /etc/nsswitch.conf returns
-rw-r--r-- 1 root root 513 2010-08-16 15:19 /etc/nsswitch.conf

looks ok too. What is the output of:

groups

If you create another user is the network access ok there?

Rohit R (rr0hit) said : #7

groups returns

rohit adm dialout cdrom plugdev lpadmin admin sambashare

Looks fine, ok try the new user and we'll see what's going on

Rohit R (rr0hit) said : #9

groups returns

rohit adm dialout cdrom plugdev lpadmin admin sambashare

On 5 September 2010 14:16, actionparsnip <
<email address hidden>> wrote:

> Your question #124177 on wget in ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/wget/+question/124177
>
> Status: Open => Needs information
>
> actionparsnip requested for more information:
> looks ok too. What is the output of:
>
> groups
>
> If you create another user is the network access ok there?
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/ubuntu/+source/wget/+question/124177
>
> You received this question notification because you are a direct
> subscriber of the question.
>

--
Rohit R
Third Year Int MSc Student
Dept of Physics
IIT Kharagpur

Rohit R (rr0hit) said : #10

Does not work for new user too...

btw

my w3m works fine

but ping and wget fails without administrative privilages

Sounds like a bug, i'd log a bug

Rohit R (rr0hit) said : #12

I got some help from irc and found out that the cause of this is messing up of environment variables due to use of "sudo su". I reinstalled with maverick and wger works fine.

thanks actionparsnip for your time...

yeah, don't use sudo su. If you want a root-like terminal then run:

sudo -i

and you won't break stuff :)