Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Security

    passwd_info 0.1

    Download button

    No screenshots available
    Downloads: 586  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Kevin Waldron | More programs
    GPL / FREE
    March 13th, 2007, 16:05 GMT
    ROOT / Security

     Read user reviews (0)  Refer to a friend  Subscribe

    passwd_info description

    passwd_info is a simple program that can query the /etc/passwd file for current user or specified user.

    passwd_info is a simple program that can query the /etc/passwd file for current user or specified user.

    USAGE: passwd_info [username]

    Sample:

    #include < unistd.h >
    #include < stdlib.h >
    #include < stdio.h >
    #include < sys/types.h >
    #include < pwd.h >
    #include < string.h >

    struct passwd *pw;

    void print_usage(void);

    int main( int argc, char *argv[] )
    {
    if ( argc > 2 ) {
    print_usage();
    exit(1);
    }

    char *name;
    uid_t uid;
    gid_t gid;
    char *gecos;
    char *dir;
    char *shell;

    char *user_arg;

    if ( argv[1] != NULL ) {
    user_arg=(char *)malloc(strlen(argv[1]));
    strcpy( user_arg, argv[1] );
    if ( (pw = getpwnam(user_arg) ) == NULL ) {
    fprintf( stderr, "Error: user %s does not existn", user_arg );
    exit(1);
    }
    uid = pw->pw_uid;
    free(user_arg);
    }
    else /* get for current user */
    {
    uid = getuid();
    pw = getpwuid(uid);
    }

    name = pw->pw_name;
    gid = pw->pw_gid;
    gecos = pw->pw_gecos;
    dir = pw->pw_dir;
    shell = pw->pw_shell;

    printf( "/etc/passwd file information for %sn", name );
    printf( "Username = %stUID = %dtGID = %dn", name, (int)uid, (int)gid );
    printf( "GECOS = %snHome = %stShell = %sn", gecos, dir, shell );

    exit(0);
    }

    void print_usage( void )
    {
    fprintf( stderr, "USAGE: passwd_info [username]n" );
    }

    Product's homepage

      


    TAGS:

    query /etc/passwd | query password | password information | passwd_info | query | /etc/passwd

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM