[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: persistent data with Sun pam



Hello.

You can Create a user. Look following code. It's not good,
but it works. Maybe you've to make some corrections.

Gero

----------------------------------------------------------------
#include <crypt.h>

int createuser(char *user, char *passwd)
{
	struct passwd* pwd;
	char str[150];
	char comment[]= "testuser";
	char skeldir[]= "/etc/skel";
	char shell[] = "/bin/bash";

	if ((pwd = getpwnam(user)) == NULL)
	{
		sprintf(str,"useradd -d /home/%s -s %s -c %s -m -k %s -p %s
%s", user, shell, comment, skeldir, \
			crypt(password,"az"), user);
		system(str);

		return 0;
	}
	
	return 0;
}





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]