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.
I am working on a script that is used to add users in a LAN. I want to run this script on a workstation and add users on a central server by using the credentials which is supplied when the script prompts. I am using SSH with the public key copied onto the server so i can run commands in the server from the local machine. The username and password are stored in variables in the local machine and i am using the useradd command.
The problem is that we cant use the $password as plain text when using the -p option, but has to supply it as encrytpted. For this I am using the utility 'grub-md5-crypt'.
Now comes the real problem:
When I run the 'grub-md5-crypt', it promts us for the string two times. After that it presents us with the encrypted string. Now I want to get this encrypted string assigned to a variable and use it with the useradd command. Really I don't know how to implement this as I am a newbie to shell scripting. The most troubling thing is that I have finished my script and am waiting for this part. Please help...
Here is a simple shell script which I placed in my /bin directory along with the expect script to add a user and encrypt their password for them. It depends upon 2 command line paramters 1=username 2=password
The bash script:
# Add client to server
/usr/sbin/adduser -m $1
passwd.exp $1 $2