Sponsored Content
Top Forums Shell Programming and Scripting Shell Script to change a user password using script Post 302474017 by indrajit_renu on Tuesday 23rd of November 2010 05:39:38 AM
Old 11-23-2010
Shell Script to change a user password using script

Hi Experts,

I had tried to executes this script to change the user password through script:

No lines in buffer
#!/bin/ksh
cat /etc/passwd | grep -v userid >> /tmp/pass.tmp1
cat /etc/passwd | grep userid >> /tmp/pass.tmp2
PASS1=`cat /tmp/pass.tmp2 | cut -d ":" -f2`
PASS2=`q2w3e4r5`
sed 's/$PASS1/$PASS2/g' /tmp/pass.tmp2 > TMPFILE && mv TMPFILE /tmp/pass.tmp2
cat /tmp/pass.tmp2 >> /tmp/pass.tmp1
mv /tmp/pass.tmp1 /etc/passwd



After executing i am getting the following error messages:
mlbept0340-root> sh -x -v testpasswd
#!/bin/ksh
cat /etc/passwd | grep -v userid >> /tmp/pass.tmp1
+ cat /etc/passwd
+ grep -v userid
+ 1>> /tmp/pass.tmp1
cat /etc/passwd | grep userid >> /tmp/pass.tmp2
+ grep userid
+ cat /etc/passwd
+ 1>> /tmp/pass.tmp2
PASS1=`cat /tmp/pass.tmp2 | cut -d ":" -f2`
+ + cat /tmp/pass.tmp2
+ cut -d : -f2
PASS1=*
PASS2=`q2w3e4r5`
+ + q2w3e4r5
testpasswd[5]: q2w3e4r5: not found.
PASS2=
sed 's/$PASS1/$PASS2/g' /tmp/pass.tmp2 > TMPFILE && mv TMPFILE /tmp/pass.tmp2
+ sed s/$PASS1/$PASS2/g /tmp/pass.tmp2
+ 1> TMPFILE
+ mv TMPFILE /tmp/pass.tmp2
cat /tmp/pass.tmp2 >> /tmp/pass.tmp1
+ cat /tmp/pass.tmp2
+ 1>> /tmp/pass.tmp1
mv /tmp/pass.tmp1 /etc/passwd
+ mv /tmp/pass.tmp1 /etc/passwd


Please suggested, and it added one more line with same user id in /etc/passwd
ucmdb:.VQDaeUFiPtWE:5555:5555::/app/common/home/ucmdb:/sbin/sh
nagios:*:112:541::/home/nagios:/sbin/sh
+::-2:-2:::
ibhagat:*:129:20::/home/ibhagat:/sbin/sh
ibhagat:*:129:20::/home/ibhagat:/sbin/sh
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How would I telnet & change user password automatically in a script

I would like to create a script that logs into a list of several servers 50+ and changes my password all at once. Every 60 days we are required to login to each system and change our passwords or else they expire and our login account is deleted. I have an idea on how I could do this but... (4 Replies)
Discussion started by: darthur
4 Replies

2. UNIX for Dummies Questions & Answers

change user through shell script

hi, my problem is that i am calling a script from my perl program. the script checks wether a particular process is running or not if the process is not running then it should start the process. the problem here is that the front end logs into backend with a user which does not have the... (0 Replies)
Discussion started by: raviraushanjha
0 Replies

3. Shell Programming and Scripting

Change Password In A Shell Script

Hi All, I have a problem. I need to write a shell script to change the password. The user may want to change his own password by this script. He will have to provide the required 3 parameters i.e. old password, new password and retype new password as arguments in command line. like,... (6 Replies)
Discussion started by: pintu_asim
6 Replies

4. Shell Programming and Scripting

How do i change to super user then revert back to ordinary user ,using shell script?

Hi all, I am trying to eject the cdrom from a livecd after certain stage... Now assuming that it is possible to eject,please consider my issue!!! The OS boots into a regular user by default...so i am unable to use the eject command to push out the drive... However if i try pfexec eject it... (3 Replies)
Discussion started by: wrapster
3 Replies

5. Shell Programming and Scripting

force to change password(shell script)

hi How can I force user to change of password by modifying the password expiry and the grace period so that the user has at least 1 week to login and change the password...... (3 Replies)
Discussion started by: tjay83
3 Replies

6. Shell Programming and Scripting

how to change root password using shell script with standard password

Hi Friends. I am new to scripting now i want to change the root password using the script with standard password. which is the easy scripting to learn for the beginner, Thanks in advance. (2 Replies)
Discussion started by: kurva
2 Replies

7. UNIX for Dummies Questions & Answers

Change user passwords using shell script

Hi, I want to change the password of unix users on a number of servers.My plan was to ssh to all the servers in a shell script and use the passwd command. I tried to do so but everytime i run it i get this error. ssh -x -n -l user1 host passwd Changing password for "user1" 3004-709 Error... (3 Replies)
Discussion started by: poojabhat
3 Replies

8. Linux

script for password change for exiting user

Dear Forum, In our organization 100 user is existing. Now i want to change password for 100 user in linux server. Pls help to write script for changing password. Regads// Taifur (3 Replies)
Discussion started by: taifurakhand
3 Replies

9. Shell Programming and Scripting

Shell script to change the password on multiple servers in linux

Can any one please let me know the shell script to change the password for a particular user on multiple linux servers. (2 Replies)
Discussion started by: s_madras
2 Replies

10. Shell Programming and Scripting

Shell script to change the password

Hi Folks, I am trying to change the password for the user "sysservice" Where my requirement is login to each server and exit from that and ssh to the next server.. I have enabled the password less auth for the user sysservice. for i in `cat /home/sysservice/servers.txt` do ssh... (1 Reply)
Discussion started by: gsiva
1 Replies
mlib_MatrixTranspose_U8(3MLIB)				    mediaLib Library Functions				    mlib_MatrixTranspose_U8(3MLIB)

NAME
mlib_MatrixTranspose_U8, mlib_MatrixTranspose_U8C, mlib_MatrixTranspose_S8, mlib_MatrixTranspose_S8C, mlib_MatrixTranspose_S16, mlib_MatrixTranspose_S16C, mlib_MatrixTranspose_S32, mlib_MatrixTranspose_S32C - matrix transpose, in place SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_MatrixTranspose_U8(mlib_u8 *xz, mlib_s32 mn); mlib_status mlib_MatrixTranspose_U8C(mlib_u8 *xz, mlib_s32 mn); mlib_status mlib_MatrixTranspose_S8(mlib_s8 *xz, mlib_s32 mn); mlib_status mlib_MatrixTranspose_S8C(mlib_s8 *xz, mlib_s32 mn); mlib_status mlib_MatrixTranspose_S16(mlib_s16 *xz, mlib_s32 mn); mlib_status mlib_MatrixTranspose_S16C(mlib_s16 *xz, mlib_s32 mn); mlib_status mlib_MatrixTranspose_S32(mlib_s32 *xz, mlib_s32 mn); mlib_status mlib_MatrixTranspose_S32C(mlib_s32 *xz, mlib_s32 mn); DESCRIPTION
Each of these functions performs an in-place transpose of a square matrix. For real data, the following pseudo code applies: for (i = 1; i < mn; i++) { for (j = 0; j < i; i++) { tmp = xz[i*mn + j]; xz[i*mn + j] = xz[j*mn + i]; xz[j*mn + i] = tmp; } } For complex data, the following pseudo code applies: for (i = 1; i < mn; i++) { for (j = 0; j < i; i++) { tmp0 = xz[2*(i*mn + j)]; tmp1 = xz[2*(i*mn + j) + 1]; xz[2*(i*mn + j)] = xz[2*(j*mn + i)]; xz[2*(i*mn + j) + 1] = xz[2*(j*mn + i) + 1]; xz[2*(j*mn + i)] = tmp0; xz[2*(j*mn + i) + 1] = tmp1; } } PARAMETERS
Each of the functions takes the following arguments: xz Pointer to the source and destination matrix. mn Number of rows and columns in the matrix. RETURN VALUES
Each of the functions returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
mlib_MatrixTranspose_U8(3MLIB), attributes(5) SunOS 5.10 10 Nov 2004 mlib_MatrixTranspose_U8(3MLIB)
All times are GMT -4. The time now is 01:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy