Professional Web Applications Themes

expiration of accounts - SCO

Hi, I have to set up useraccounts with rexec. So I'm only able te execute a command. I can't use dialogs (as needed for passwd). What I do so far is the following: useradd -u <UID> -d /<HOMEDIR>/<LOGNAME> -c '<DESCRIPTION>' <LOGNAME> which creates an new account with all options I need. The next I use is chpass, which sources I found in a newsgroup. chpass <LOGNAME> <PASSWORD> which set's a password for the account. Everything is ok with chpass for accounts that already exist. The new password is set correctly. With new accounts the user gets an "account expired" on ...

  1. #1

    Default expiration of accounts

    Hi,

    I have to set up useraccounts with rexec. So I'm only able te execute a
    command. I can't use dialogs (as needed for passwd). What I do so far is
    the following:
    useradd -u <UID> -d /<HOMEDIR>/<LOGNAME> -c '<DESCRIPTION>' <LOGNAME>
    which creates an new account with all options I need.

    The next I use is chpass, which sources I found in a newsgroup.
    chpass <LOGNAME> <PASSWORD>
    which set's a password for the account.

    Everything is ok with chpass for accounts that already exist. The new
    password is set correctly. With new accounts the user gets an "account
    expired" on first login. Is there a chance to set the expiration-date
    for accounts?

    Thanks in advance,
    Daniel

    Daniel Guest

  2. #2

    Default Re: expiration of accounts

    In article <bpcm0e$kg8$03$t-online.com>,
    Daniel Voelkel <net> wrote: 

    Are you sure the message is 'account expired'?
    What OS and release are you using?
    You should also include a pointer to the 'chpass' that you used.

    John
    --
    John DuBois com KC6QKZ/AE http://www.armory.com/~spcecdt/
    John Guest

  3. #3

    Default Re: expiration of accounts

    > Are you sure the message is 'account expired'? 

    Sorry. Correctly the password has expired, not the account. :-/
    That's what happens on first login of the new account.

    ----
    login: dvtest
    Password:
    Last successful login for dvtest: NEVER
    Last unsuccessful login for dvtest: NEVER
    Your password has expired
    Setting password for user: dvtest
    Old password:
    ----


    The sourcecode of "chpass" is as follows:
    ----
    #include <sys/types.h>
    #include <sys/security.h>
    #include <sys/audit.h>
    #include <prot.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <ctype.h>
    #include <string.h>
    #include <time.h>

    /** Global variables **/
    static struct pr_passwd *p;

    int main(argc, argv)
    int argc;
    char *argv[];
    {
    char salt[3], *passwd, *newpasswd;
    set_auth_parameters(argc, argv);
    if ((argc < 3) && (argc > 4))
    { return (1);
    }

    if ((p = getprpwnam(argv[1])) == NULL)
    { return (1);
    }

    if (argc == 4)
    { salt[0] = p->ufld.fd_encrypt[0];
    salt[1] = p->ufld.fd_encrypt[1];
    salt[2] = '\0';

    if (strcmp(bigcrypt(argv[2], salt), p->ufld.fd_encrypt) != 0 )

    return(2);
    }

    sprintf(salt,"%2.2d",(time((time_t *)NULL) % 100));
    strcpy(p->ufld.fd_encrypt, bigcrypt(argv[argc - 1], salt));
    return (putprpwnam(argv[1], p) ? 0 : 1);
    }
    ----


    Daniel




    Daniel Guest

  4. #4

    Default Re: expiration of accounts

    In article <bphtao$ej6$03$t-online.com>,
    Daniel Voelkel <net> wrote: 

    After an account is created with useradd, it can't be logged into until the
    protected password database indicates that the password has been set. The
    program you're using sets the password, but fails to set the time the password
    was set, which indicates to the login process that the password still has never
    been set.

    In the following code, the only change made is to add this line:

    p->ufld.fd_schange = time(NULL);

    I've include the entire program here for the sake of future readers.

    John

    #include <sys/types.h>
    #include <sys/security.h>
    #include <sys/audit.h>
    #include <prot.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <ctype.h>
    #include <string.h>
    #include <time.h>

    /** Global variables **/
    static struct pr_passwd *p;

    int main(argc, argv)
    int argc;
    char *argv[];
    {
    char salt[3], *passwd, *newpasswd;
    set_auth_parameters(argc, argv);
    if ((argc < 3) && (argc > 4))
    { return (1);
    }

    if ((p = getprpwnam(argv[1])) == NULL)
    { return (1);
    }

    if (argc == 4)
    { salt[0] = p->ufld.fd_encrypt[0];
    salt[1] = p->ufld.fd_encrypt[1];
    salt[2] = '\0';

    if (strcmp(bigcrypt(argv[2], salt), p->ufld.fd_encrypt) != 0 )

    return(2);
    }

    sprintf(salt,"%2.2d",(time((time_t *)NULL) % 100));
    strcpy(p->ufld.fd_encrypt, bigcrypt(argv[argc - 1], salt));
    p->ufld.fd_schange = time(NULL);
    return (putprpwnam(argv[1], p) ? 0 : 1);
    }
    --
    John DuBois com KC6QKZ/AE http://www.armory.com/~spcecdt/
    John Guest

  5. #5

    Default Re: expiration of accounts

    John DuBois wrote: 

    Thanks a lot. It works.

    Daniel Guest

Similar Threads

  1. Page expiration
    By Majid in forum ASP.NET Security
    Replies: 0
    Last Post: February 24th, 09:01 AM
  2. XP expiration
    By Miha in forum Windows Setup, Administration & Security
    Replies: 1
    Last Post: July 28th, 07:24 PM
  3. password expiration
    By Susan in forum Windows Setup, Administration & Security
    Replies: 0
    Last Post: July 26th, 04:33 PM
  4. password expiration
    By chris in forum Windows XP/2000/ME
    Replies: 7
    Last Post: July 19th, 04:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139