SSH user not able to resolv hostnames

Discussion in 'General' started by Coilernl, Aug 24, 2011.

  1. Coilernl

    Coilernl New Member

    Somehow when an user (made by ispconfig in chrooted jail) logs in he can't resolve any hostnames, using the wget (or svn) commands he just gets "Resolving {ADDRESS}... failed: Name or service not known.
    wget: unable to resolve host address"

    this only seems to occur with chrooted users, normal users can just do everything.

    I've probably missed something, I just can't seem to find out what :confused:

    Thanks in advance,
     
  2. Mark_NL

    Mark_NL Member

    I'm guessing the jailrooted user is missing the file /etc/resolv.conf ?

    Try copying that file to the users' jailroot and see if it resolves the problem.

    I've tested this on the svn version and seems to work just fine.
     
  3. Coilernl

    Coilernl New Member

    The user is getting the resolv.etc file, can open it and it contains the right data.
    Should have put that in my first post
     
  4. Mark_NL

    Mark_NL Member

    So as a jailed user commands like nslookup/dig/host don't work, but as a regular shell user they do?
     
  5. Coilernl

    Coilernl New Member

    Hadn't tried the host command yet, this works :confused: (nslookup and dig are not in my chroot)

    Heres the output of host, ping and wget:
    Code:
    test@{MYSERVER}:/tmp$ host www.google.com
    www.google.com is an alias for www.l.google.com.
    www.l.google.com has address 74.125.77.104
    www.l.google.com has address 74.125.77.147
    www.l.google.com has address 74.125.77.99
    
    test@{MYSERVER}:/tmp$ ping www.google.com
    ping: unknown host www.google.com
    test@{MYSERVER}:/tmp$ wget www.google.com
    --2011-08-25 08:03:34--  http://www.google.com/
    Resolving www.google.com... failed: Name or service not known.
    wget: unable to resolve host address `www.google.com'
    
    somehow the host command works fine even though the ping and wget fail :eek:
     
  6. Mark_NL

    Mark_NL Member

    Try setting the nameservers to the ones of opendns and try again:

    nameserver 208.67.222.222
    nameserver 208.67.220.220

    replace these with the one in your /etc/resolv.conf
     
  7. Coilernl

    Coilernl New Member

    Tried that and doesn't help (I was already using the google DNS servers anyway).
    I'm thinking it has to do with certain files not being copied.
     
  8. Coilernl

    Coilernl New Member

    Nobody else that has an idea where I should look for this problem?
    I would like to continue working on testing ISPconfig
     
  9. falko

    falko Super Moderator Howtoforge Staff

  10. Coilernl

    Coilernl New Member

    Falko, when looking at the 2nd problem I test it using an php script and it works fine (no dns problem) and the output is:
    Code:
    Array ( [0] => Array ( [host] => www.howtoforge.com [type] => A [ip] => 188.40.16.205 [class] => IN [ttl] => 180 ) )
    Which looks fine to me, would it still be usefull to add those files (from the first link) to my chrooted jail?
     
  11. falko

    falko Super Moderator Howtoforge Staff

    Both links suggest more or less the same, so if it's working now, it should be fine. :)
     
  12. Coilernl

    Coilernl New Member

    The issue still remains, still getting the error message when using wget, svn or ping command.
     
  13. falko

    falko Super Moderator Howtoforge Staff

    But it works from a PHP script inside the chroot?

    Please check if all needed libraries for a tool are inside your chroot. You can find out about the required libraries for a program as follows:

    Code:
    ldd /usr/bin/wget | awk '{ print $3 }'
    Do you have /lib/libnss_compat.so.2, /lib/libnsl.so.1, and /lib/libnss_files.so.2 in the lib directory in your chroot?
     

Share This Page