1

I am trying to ssh into my board ( Imx6 Humming board) through my PC using Putty.I get "unexpectedly closed network connection" immediately after login prompt in putty. Replacing these 2 libraries inside the root file system, solves the issue. Why are these files creating a problem and what dependency do they have on ssh? Any help regarding these two library files would be appreciated.

1 Answer 1

2

libnss_files.so is the library that actually reads /etc/passwd, /etc/group, /etc/hosts. Without it, programs won't be able to look up usernames and user IDs – OpenSSH won't know your UID and your home directory; in fact it won't know that you exist.

Similarly, libnss_dns.so is the library that makes DNS queries. It's not the only DNS library on your system, but it's the one that handles generic "resolve domain to address" functions that most programs use.


In general, they're Glibc modules that handle directory information lookups from DNS and files, respectively. Here "directory information" means 1) user accounts, like in /etc/passwd or /etc/group, and 2) hostnames, like in DNS or /etc/hosts. (In other words, directory as in phone book – not directory as in file folder.)

The libc standard library, used by programs written in C, has generic functions for looking up directory information regardless of source. That is, the actual programs don't need to care about DNS or /etc – they just call the libc function to look up a username (or a hostname, or a group, or a TCP port...), and libc gets it from whatever source is appropriate.

Glibc, the libc used on most Linux systems, has modular information sources – the system admin can add new ones, reorder them, etc. Instead of the libc "core" knowing the specifics of /etc/passwd or /etc/hosts, it delegates that task to the "libnss_files" module – and similarly, knowledge about DNS is in the "libnss_dns" module.

Whenever a program needs to resolve a domain name, libc then goes through each module configured in /etc/nsswitch.conf – first it asks the 'files' module (which checks /etc/hosts), then the 'dns' module (which checks DNS), until it gets an answer. There might be other modules for mDNS (".local" domains), NetBIOS, etc.

Similarly, whenever a program needs to resolve a username to UID, or a UID to username, libc asks the 'files' module to get users from /etc/passwd. (Again, there might be other modules like 'ldap' or 'pgsql' or 'nis' that get user account information from alternative sources.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .