Create new user account and password in shell script
I am trying to create a shell script that will:
check if a specific user already exists
if not, create a specific group and create the user in that group
assign a password to that user, where the password is passed in as a parameter to the script
The problem that I need help with is 3 on Solaris and AIX.
I can do 1 (using the id command) and 2 (using mkgroup or groupadd and useradd commands), but setting the password is where I am having problems. I have got it to work on Linux by redirecting input to the passwd command but I can not find how to get the same functionality to work on AIX and Solaris. This is what I have so far:
I've searched the forums and found some similar postings but nothing seems to answer exactly what I'm looking for.
Some additional information that might preempt some questions:
the script will only be run by the root user
there is not an issue with storing the password unencrypted in a flat file because it will be entered by the user as a parameter at run-time
the script has to be executable on Linux X86, Linux s390x, Solaris 10, and AIX 6
the script can not use any command, utility, or any other software that is not installed on the OS by default, so an answer along the lines of "download and install this..." is no good to me.
I can not use an answer that involves using perl
I can not use an answer that involves using the expect command
If it can't be done, because of something like OS security restrictions and limitations, then please let me know and I'll stop trying to script it!
Thanks in advance for any help or pointers that anyone can provide.
There is no way to do what you want on Solaris using the passwd command. You could download and compile a tool like chpasswd, but you don't want to do that.
One option is to change the password on one server, and then use information in the shadow file to update the other servers.
For AIX, the tool chpasswd should already be available. It's easy enough to use - check the man page.
I want to create a shell script to gather user account information and displays the result to administrator.
I have created a script but its showing all the information when i search for username like:
amit@mx:~$ ./uinfo.sh amit
Username : amit
User Info ... (2 Replies)
Hi Folks,
I had a request to create the user request. Between, I just write a script a create, Update Geos, and update the password. My script as below:
The error message, what I am getting is all the users are updated with the same Goes value..
#!/bin/bash
for i in `cat users.txt`;do... (2 Replies)
hi guys
I have Centos 5.4
The idea is lock the user account for 3 minutes after he has entered his password incorrectly 3 times.
I've modified /etc/pam.d/system-auth
auth required pam_tally.so onerr=fail per_user deny=3
account required pam_tally.so resetbesides... (3 Replies)
Hi All,
I have one requirment..
I need to change my id to some sudo account in a server.. Actually our username/passwd will be stored in one gip file like below...
$cat .a.gz #It's hidden file
username
passwd
$
So I tried the below script to pass the password when i sudo to... (7 Replies)
hello friends,
one user is created named "user1"
I login as "user1" . Now when i do "su -" to be root user I have to give password for root .
Is there any way through which we can skip giving the password to root.
i.e.
user1@work:~$ su -
Password: xxxxxx
work:~$
I don't want that... (1 Reply)
My company has about 40 databases with each database in a different logical partition. Presently the SysAdmin person says it is necessary to create a user profile (login and password for each instance of databases on each LPAR.
1. Is it necessary that the user must be created in each LPAR?
2.... (1 Reply)
Hi All,
I'm using solaris 2.8, and I want create a new ftp user account with the following restrictions:
- Have only ftp access, no telnet or rlogin
- Have restricted access to its home directory example /export/home/newuser
- Deny access to any other directory.
Thanks for your help,
... (6 Replies)