Ok, first off, I'm working on a Vmware ESX server, which I guess is loosely based off of Red Hat 9. But I'm brand new to it (today), so be nice.
I'm trying to write a useradd script that will create some users, generate a password, and set their password to this newly generated password.
Now by hand, I can use the useradd command, and then use passwd to change their password. But if I've got to set up a couple hundred users, this is not enjoyable.
So if I can't use passwd in a script (because it requires user interaction), how can I create these users with some default password?
This is on an ESX 3.x.x box, but you've got a few options.
The first is to use the --stdin option to passwd, e.g.
This would require you storing the plain text password in your script. A *much* safer option is to add a user and set the password as you normally would to a standard value, e.g.
Now, you can use the encrypted password for this user when creating other accounts, so that all newly created accounts have the same password as "tmpuser", e.g.
Cheers,
ZB
This is on an ESX 3.x.x box, but you've got a few options.
The first is to use the --stdin option to passwd, e.g.
This would require you storing the plain text password in your script. A *much* safer option is to add a user and set the password as you normally would to a standard value, e.g.
Now, you can use the encrypted password for this user when creating other accounts, so that all newly created accounts have the same password as "tmpuser", e.g.
Cheers,
ZB
Thanks for the reply. I would have replied back sooner, but haven't gotten a chance to try it out till now. I actually like the --stdin option. The script actually won't be holding a plain text password. What I would like to do is generate a random password in my script, and pass it to --stdin.
I just have one problem. I'm really new to Vmware ESX, but I was able to find a little script that generates a password. Here it is:
As you can see, all that script does is generate the password, and then echo it out. But I've never seen where you can just use "echo" and not tell it what to echo. So what variable is my password being stored in? If it's $index, then how can I use it with --stdin?
The problem comes when I try to use it, putting this in my code:
because the "echo" is also printing out the password, so do you know how I can use this to my advantage?
for UserName in `cat users` ; do useradd -d /u02 -s /usr/libexec/openssh/sftp-server -G ftp-users $UserName ;
PassWord=$( echo $( tr '' '' <<< ${UserName:0:1} )${UserName:1} ) ;
echo "$PassWord@123" | passwd $UserName --stdin ; done
can some one explain what the bold text do
Please use... (5 Replies)
Hi,
I want to exclude the users below 500 in the password file with the below script.
#!/bin/bash
# get date in dd-mm-yyyy format
NOW=$(date +"%d-%m-%Y")
exec > "/root/SYSINFO/User_details_`uname -n`_$NOW.txt"
cut -d: -f1 /etc/passwd > /tmp/pass.txt && for i in `cat /tmp/pass.txt`;... (2 Replies)
Hello all,
I have a small C++ app for my solaris admins. I need to set it up so they can reset a users password. The admin does not have the old password. How can I reset a users password to a temp password either using passwd or PAM? I need to do this from within my C++ app. I have searched... (3 Replies)
I am on SunOS SolarisServer 5.11 11.1 i86pc i386 i86pc , I am trying to change password for a user,but I get the following message.I cannot find any google help on the matter.can anyone help?
root@SolarisServer:~# passwd
passwd: Changing password for stain
Please try again
Please try... (6 Replies)
Hi there,
I'm working with a Linux server and now I can get a daily Logwatch mail ... my question is:since there are too many users with root password (...in my opinion... :mad:) how could I prevent to delete information about "su" log?
Thanks in advance,
GB (3 Replies)
We have a server where we have a number of user ids and we also have the list of old passwords in a CSV file.
Now we want to change the password of all the users and assign them a default password.Can we write a shell script to do that.
I am planning to read the user name and corresponding... (7 Replies)
Ok, so here's my project I've been given and I know very little about this.
I have an AIX unix box that has over 2300 local users.
Any user with 4 or less characters in the username does not get changed.
Any user with 5 or more needs to have the attribute shell=/bin/ksh changed to... (1 Reply)
As a system administrator. sometimes we see the users are trying some commands dangerous for the system health and remove them from their individual coomand history file.
How it is possible to enforce that the normal usres will will not be able to modify the history.
Thanks in advance.
Partha (4 Replies)
How can I know users have changed their passwords ? I don't need their password (!) I have to know if they have changed their pass word and when ?
Thank you in advance for any SIMPLE answer. (6 Replies)
I would like to change the password requirements for all our AIX 5.2 logins but am having trouble finding a place where I can set the rules for everyone at the same time. I know I can go user by user in smit passwords but is there a way to create rules for everyone at the same time?
Thanks,... (2 Replies)