ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Hi guys Ive been working on this one for a couple of hours and I still havent figured it out........Ive got a script to add users it worked fine but the problem was that I needed to hash the password in the useradd -p argument to make the whole process valid.......when I hash the password nothing happens the script does not give me any output.....ex: if I try to add the same users twice the system would have presented me with the output of the useradd command "users exists" but now it just swallows my input without further notic
//create the user with the supplied args
$command = "sudo useradd $username ";
if($group != "")
$command = $command. "-g $group ";
$command = $command. "-d $home_dir ";
if($shell == "")
$command = $command. "-s /bin/bash ";
$command = $command. "-s shell ";
$command = $command. "-c $comment ";
//the line below is used to hash the password
$encrypted_pwd = "sudo openssl passwd -crypt $password";
//asign password to the output of the encrypt function
$password = shell_exec($encrypted_pwd);
$command = $command. "-p $password ";
$command = $command.' 2>&1';
$function_call = shell_exec($command);
//The problem is that echo $function_call is not sending anything even if I try to send the same username more than once........that does not happen when I remove the hashed password and jsut supply a usertyped password......
Ok for all those guys who might need an answer to this question .........use the crypt() function in PHP, it takes to arguments one is the word to be hashed and the second is the hash salt..........actually the second argument determines what kind of hashing you want ot use.......md5 standard des blowfish etc..........when you get the output give it to useradd -p $output and it will work just fine......