# scp: unknown user

## tilman

Hi

Problem:

=======

~ $ scp

unknown user 1000

For whatever reason, the problem seems only be related to scp and the user 1000. As root, it seems to work:

# scp

usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]

           [-l limit] [-o ssh_option] [-P port] [-S program]

           [[user@]host1:]file1 ... [[user@]host2:]file2

Unsuccessful attempt to reproduce the problem as user 1000:

============================================

~ $ cat user.c

#include <stdio.h>

#include <unistd.h>

#include <sys/types.h>

#include <pwd.h>

int main(int argc, char** argv)

{

   struct passwd *pwd;

   uid_t userid;

   if ((pwd = getpwuid(userid = getuid())) == NULL)

     printf("unknown user %u\n", (u_int) userid);

   printf("user: %u\n",(u_int) userid);

}

~ $ ./user

user: 1000

Can anybody kindely assist ?

Thanks

Tilman

----------

## tomk

What are the permissions on /etc/passwd?

----------

## tilman

I guess my gentoo installation became somehow inconsistent:

```

~ $ ls -lh /etc/passwd

-rw-r--r-- 1 root root 1.1K Oct 17  2011 /etc/passwd

~ $ which scp

/usr/local/bin/scp

~ $ ls -la /usr/local/bin/scp

-rwxr-xr-x 1 root root 678253 Oct 17  2011 /usr/local/bin/scp

 ~ $ ls -la /usr/bin/scp

-rwxr-xr-x 1 root root 54912 Apr  1 01:49 /usr/bin/scp

~ $ ldd /usr/local/bin/scp

        not a dynamic executable

~ $ ldd /usr/bin/scp

        linux-gate.so.1 =>  (0xb77eb000)

        libpthread.so.0 => /lib/libpthread.so.0 (0xb77a3000)

        libc.so.6 => /lib/libc.so.6 (0xb7649000)

        /lib/ld-linux.so.2 (0xb77cf000)

```

/usr/local/bin/scp does not work and terminates with the  unknown user message. It seems not to be a permission issue. Removing /usr/local/bin/scp fixes the issue as now scp in /usr/bin runs.

Thanks for the hint regarding /etc/passwd.

----------

