@Rudic, as previously stated, there is nothing wrong with the way it changes the password. There is something wrong with the loop. Everything the way it is, correctly changes one password for one server, but it doesn't catch the rest of the servers.
---------- Post updated at 10:00 AM ---------- Previous update was at 09:44 AM ----------
Quote:
Originally Posted by drysdalk
Hi,
OK, thanks. And it works on all four servers if done manually, and not just munsbxlinux3 ?
Well, good thinking, NO, when I ran the command by itself on the command line, giving it the server name manually, it hung for Solaris 10 box (prdcatap1).
Good to know that the problem is now identified and that you have a working solution for the Linux systems, at least. As for the Solaris one, you'll most likely have to find an alternative way of re-setting the password for that one host, or find one other common method that works across all platforms. The 'chpasswd' and 'usermod' ideas mentioned by RudiC and Chubler_XL would certainly be the best place to start.
I don't readily have access to a Solaris system to test things on myself just now, but will have a play about this evening if I can if you're still in need of an answer then.
OK guys, thanks so much @drysdalk for your excellent trouble shooting idea (running every command individually on the command line). The script works perfect, the way it is, it only hangs on stupid Solaris and since the Solaris box was on the top of the data file, it would hang on it and not go further. I removed the Solaris box from my data file and everything ran just fine. Please see below. I guess the problem now gets reduced to how to do this **** on Solaris?
Thanks, everyone, you guys are great.
Moderator's Comments:
Please use CODE tags as required by forum rules!
AND - please watch your language! see below:
Hello,
Per our forum rules, all users must write in English, use semi-formal or formal English language and style, and correct spelling errors.
The reason for this is that most software and operating systems are written in English and these are software related technical forums.
In addition, nearly 95% of all visitors to this site come here because they are referred by a search engine. In order for future searches on your post (with answers) to work well, you need to spell correctly!
So, as a benefit and courtesy to current and future knowledge seekers, please be careful with your language, check your spelling and correct your spelling errors. You might receive a forum infraction if you don't pay attention to this.
Also, do not write in cyberpunk or abbreviated chat style under any circumstances and do not use profanity. This is not a chat room, it is a formal knowledge base to serve you and everyone, of all ages and cultural backgrounds.
Thanks!
The UNIX and Linux Forums
---------- Post updated at 11:17 AM ---------- Previous update was at 10:11 AM ----------
Quote:
Originally Posted by drysdalk
Hi,
Good to know that the problem is now identified and that you have a working solution for the Linux systems, at least. As for the Solaris one, you'll most likely have to find an alternative way of re-setting the password for that one host, or find one other common method that works across all platforms. The 'chpasswd' and 'usermod' ideas mentioned by RudiC and Chubler_XL would certainly be the best place to start.
I don't readily have access to a Solaris system to test things on myself just now, but will have a play about this evening if I can if you're still in need of an answer then.
So, apparently (as far as I can tell) Solaris doesn't have the chpasswd command and doesn't support "usermod -w" switch to change passwords non-interactively. Strange, but true (again, as far as I can tell).
Last edited by rbatte1; 02-22-2017 at 01:45 PM..
Reason: RudiC Added CODE tags.; rbatte1 removed expletive
I've looked into this a bit further, although I don't myself have a full Oracle Solaris system to test on; rather, at home I have a system running Tribblix, an Illumos distro. So there will certainly be some differences beween that and Oracle's Solaris, which I can't really legitimately run for free at the moment due to the licensing requirements it has.
Anyway, I tend to agree that based on both my own findings on my system and what I've read elsewhere that you're going to have to find a more complicated solution here. An expect script might be the kind of road you have to go down, or a Perl script or somesuch. As an absolute last resort you could do something that directly manipulates /etc/passwd and /etc/shadow, but I can't stress how strongly enough I recommend not doing that.
Apparently, Solaris & Linux are a lot different and NOT just a little. I couldn't get the simple scp command to work on Solaris and it worked perfectly on all flavors of Linux.
.
Moderator's Comments:
Please use CODE tags as required by forum rules!
Last edited by RudiC; 02-23-2017 at 02:52 PM..
Reason: Added CODE tags.
If that is just a comment not requiring follow-up, fine.
If not, open a new thread, giving exact and complete infos on WHAT and HOW doesn't work, using code tags where appropriate and required by forum rules.
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)
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)
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)
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)
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)
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)
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)
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)
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)