Sponsored Content
Top Forums Shell Programming and Scripting A script to change password for all other servers Post 302992123 by Hiroshi on Tuesday 21st of February 2017 05:18:05 PM
Old 02-21-2017
that command by itself on the command line works perfect. Please see below:
Code:
root@tstnglbz1 # ssh -n munsbxlinux3 'echo -e "TestPW12345!\nTestPW12345!" | passwd mcha>
New password: Retype new password: Changing password for user mchavoshi.
passwd: all authentication tokens updated successfully.
root@tstnglbz1 #

Moderator's Comments:
Mod Comment
Please wrap all code, files, input & output/errors in CODE tags as in the rules.
It makes it far easier to read and preserves multiple spaces for indenting or fixed width data.

Last edited by rbatte1; 02-22-2017 at 07:57 AM.. Reason: Code tags again.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to script to logon servers using id and password

Hey.. I am new in scripting.. I know a little bit of scripting.. I am facing some problem.. I need to create a script using which I may log on to a server (e.g. ftp) with ID and password.. thus copy a particular file to a local dir.. the commands required to do that I do know.. I am able to do it... (1 Reply)
Discussion started by: razeeev
1 Replies

2. Shell Programming and Scripting

script to change passwords for the same user on multiple servers

I am trying to write a script to change passwords for the same user on multiple servers. My environment runs purely ssh / scp not rsh / rcp and therefore coping using rcp is not an option. I have been playing with expect to perform tasks but think there must be a better way. Has anyone got... (7 Replies)
Discussion started by: stolz
7 Replies

3. 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

4. Red Hat

Change password of linux servers remotely

Hi, I am very bad at scripting. I need help from scripting experts... I need to change password of around 100 linux remote servers. I have been given a script for changing the password that automates the task. however I do not understand the usage and meaning of the script, the script is an... (0 Replies)
Discussion started by: renuka
0 Replies

5. Shell Programming and Scripting

Script:Change password on 1000+ servers

Hello Folks Scenario : I have a linux box (expect tool installed) which connects to 1000+ other boxes (either Solaris or AIX or Linux ) with a specific id and password using SSH. I now wish to write a script (Shell and/or expect and/or Python) which will change this existing password to a... (1 Reply)
Discussion started by: ak835
1 Replies

6. Solaris

Change passwd for bulk servers using SSH script

Hi, I need to Change passwd for bulk servers using SSH script. I have one server, from which i can reach all the servers without password via SSH. There is some expect script, from which i can achieve it. Can any one help me out here. Thanks in advance. Vicky (1 Reply)
Discussion started by: vickyingle5
1 Replies

7. 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

8. Shell Programming and Scripting

Script for login to servers with user name and password and execute commands

I am having the 15 servers which need to do the monitoring Hi I need a shell script, By which i can log in to multiple servers and execute the commands.. I need to specify the username and password in the scripts. Please help me to write the script so that it can login with username and... (5 Replies)
Discussion started by: nandan8a
5 Replies

9. AIX

How to write a script to run without password on a batch of servers?

I need run a command such as ps -ef |grep xxx on a batch of servers, how to write a script to run it without password? don't need go in each server to check? Thanks (7 Replies)
Discussion started by: rainbow_bean
7 Replies

10. Shell Programming and Scripting

Shell script to set user password to never expire in UNIX servers

Hi, I have a requirement where in i need to write a shell script to set users password to never expire. I know the command which is used to perform the same .. which is chage command. But, could not figure out how to do the same in shell script. Could you please help me with the shell... (3 Replies)
Discussion started by: suren424
3 Replies
PASSWD(1)							  User utilities							 PASSWD(1)

NAME
passwd - update user's authentication tokens SYNOPSIS
passwd [-k] [-l] [-u [-f]] [-d] [-e] [-n mindays] [-x maxdays] [-w warndays] [-i inactivedays] [-S] [--stdin] [username] DESCRIPTION
The passwd utility is used to update user's authentication token(s). This task is achieved through calls to the Linux-PAM and Libuser API. Essentially, it initializes itself as a "passwd" service with Linux- PAM and utilizes configured password modules to authenticate and then update a user's password. A simple entry in the global Linux-PAM configuration file for this service would be: # # passwd service entry that does strength checking of # a proposed password before updating it. # passwd password requisite pam_cracklib.so retry=3 passwd password required pam_unix.so use_authtok # Note, other module types are not required for this application to function correctly. OPTIONS
-k, --keep The option -k is used to indicate that the update should only be for expired authentication tokens (passwords); the user wishes to keep their non-expired tokens as before. -l, --lock This option is used to lock the password of specified account and it is available to root only. The locking is performed by render- ing the encrypted password into an invalid string (by prefixing the encrypted string with an !). Note that the account is not fully locked - the user can still log in by other means of authentication such as the ssh public key authentication. Use chage -E 0 user command instead for full account locking. --stdin This option is used to indicate that passwd should read the new password from standard input, which can be a pipe. -u, --unlock This is the reverse of the -l option - it will unlock the account password by removing the ! prefix. This option is available to root only. By default passwd will refuse to create a passwordless account (it will not unlock an account that has only "!" as a password). The force option -f will override this protection. -d, --delete This is a quick way to delete a password for an account. It will set the named account passwordless. Available to root only. -e, --expire This is a quick way to expire a password for an account. The user will be forced to change the password during the next login attempt. Available to root only. -f, --force Force the specified operation. -n, --minimum DAYS This will set the minimum password lifetime, in days, if the user's account supports password lifetimes. Available to root only. -x, --maximum DAYS This will set the maximum password lifetime, in days, if the user's account supports password lifetimes. Available to root only. -w, --warning DAYS This will set the number of days in advance the user will begin receiving warnings that her password will expire, if the user's account supports password lifetimes. Available to root only. -i, --inactive DAYS This will set the number of days which will pass before an expired password for this account will be taken to mean that the account is inactive and should be disabled, if the user's account supports password lifetimes. Available to root only. -S, --status This will output a short information about the status of the password for a given account. Available to root user only. Remember the following two principles Protect your password. Don't write down your password - memorize it. In particular, don't write it down and leave it anywhere, and don't place it in an unencrypted file! Use unrelated passwords for systems controlled by different organizations. Don't give or share your password, in particular to someone claiming to be from computer support or a vendor. Don't let anyone watch you enter your password. Don't enter your password to a computer you don't trust or if things "look funny"; someone may be trying to hijack your password. Use the password for a limited time and change it periodically. Choose a hard-to-guess password. passwd through the calls to the pam_cracklib PAM module will try to prevent you from choosing a really bad password, but it isn't foolproof; create your password wisely. Don't use something you'd find in a dictionary (in any language or jargon). Don't use a name (including that of a spouse, parent, child, pet, fantasy character, famous person, and location) or any variation of your per- sonal or account name. Don't use accessible information about you (such as your phone number, license plate, or social security number) or your environment. Don't use a birthday or a simple pattern (such as "qwerty", "abc", or "aaa"). Don't use any of those backwards, followed by a digit, or preceded by a digit. Instead, use a mixture of upper and lower case letters, as well as digits or punctuation. When choosing a new password, make sure it's unrelated to any previous password. Use long passwords (say at least 8 characters long). You might use a word pair with punctuation inserted, a passphrase (an understandable sequence of words), or the first letter of each word in a passphrase. These principles are partially enforced by the system, but only partly so. Vigilance on your part will make the system much more secure. EXIT CODE
On successful completion of its task, passwd will complete with exit code 0. An exit code of 1 indicates an error occurred. Textual errors are written to the standard error stream. CONFORMING TO
Linux-PAM (Pluggable Authentication modules for Linux). FILES
/etc/pam.d/passwd - the Linux-PAM configuration file BUGS
None known. SEE ALSO
pam(8), pam.d(5), libuser.conf(5), and pam_chauthtok(3). For more complete information on how to configure this application with Linux-PAM, see the Linux-PAM System Administrators' Guide. AUTHOR
Cristian Gafton <gafton@redhat.com> GNU
/Linux Jun 20 2012 PASSWD(1)
All times are GMT -4. The time now is 05:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy