User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 428,215 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,229 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 22212 | Replies: 18
Reply
Join Date: Sep 2006
Posts: 29
Reputation: sut is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
sut sut is offline Offline
Light Poster

Troubleshooting Re: Change Password In A Shell Script (with perl)

  #11  
Sep 11th, 2006
Hi. This is what I've put together so far. Can somebody tell me what I am doing wrong? I've searched the web and read the manuals but I just can't see how to get the communication with passwd to go directly through the terminal. I think I need to make the newly opened tty the controling tty but apparently don't know how.

I am working on AIX 5.2 and am not allowed to install IO:ty or expect. So I need to roll my own.

Thank you very much for any pointers.
Attached Files
File Type: txt ttypasswd.pl.txt (1.5 KB, 155 views)
Reply With Quote  
Join Date: Sep 2006
Posts: 29
Reputation: sut is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
sut sut is offline Offline
Light Poster

Re: Change Password In A Shell Script

  #12  
Sep 13th, 2006
Hi. It works now. The attached script works on SYS V type terminals and was tested on AIX 5.3. I will eventually get it working on Sun and Linux and will need to work out the Berkly style TTYs which involves a bit of code similar to:

found: {
  for $bank ('p'..'z') {
    for $unit (('0'..'9'),('a'..'f')) {
      # +> : access in read/write mode
      open(PTY, "+>/dev/pty$bank$unit") || next;
      $s = select(PTY); $| = 1; select($s);
      open(TTY, "+>/dev/tty$bank$unit") || next;
      $s = select(TTY); $| = 1; select($s);
      last found;
      }
    }
  die "$0: Cannot find a free pty\n";
  }

Let me know if anybody cares.
Attached Files
File Type: txt ttypasswd.pl.txt (1.7 KB, 169 views)
Reply With Quote  
Join Date: Oct 2006
Posts: 1
Reputation: cwb is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
cwb cwb is offline Offline
Newbie Poster

Re: Change Password In A Shell Script

  #13  
Oct 27th, 2006
I am interested if you ever get the Berkly style working, I would like to see it.
Reply With Quote  
Join Date: Apr 2006
Location: India
Posts: 16
Reputation: kamitsin is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
kamitsin kamitsin is offline Offline
Newbie Poster

Re: Change Password In A Shell Script

  #14  
Nov 6th, 2006
Originally Posted by cwb View Post
I am interested if you ever get the Berkly style working, I would like to see it.
Hi Amit,

Im looking for the script which you have for changing password on multiple servers. Would you mind sending them to me at.

Thanks and regards,
VinodKumar

Hi folks !!!!

First of all i am sorry for not replying to your posts.

Please let me know if you still require the script and i will post it in the thread.

Thanks,
Amit
Reply With Quote  
Join Date: Dec 2006
Posts: 1
Reputation: shelbyg75 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
shelbyg75 shelbyg75 is offline Offline
Newbie Poster

Re: Change Password In A Shell Script

  #15  
Dec 6th, 2006
Originally Posted by kamitsin View Post
Hi folks !!!!

First of all i am sorry for not replying to your posts.

Please let me know if you still require the script and i will post it in the thread.

Thanks,
Amit


If you could post the script I would very much appreciate it

Shelby
Reply With Quote  
Join Date: May 2007
Location: India
Posts: 1
Reputation: Curi_us is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Curi_us Curi_us is offline Offline
Newbie Poster

Help Re: Change Password In A Shell Script

  #16  
May 5th, 2007
Originally Posted by kamitsin View Post
i am using a shell script which changes the password of all the servers in the network and also of the host server (as per your requirement) but it uses except.

Earlier i had a perl script to change the password.

If you want i can give you both the scripts and you can modify them as per your requirement.

Amit


Hello Amit,
I was looking out for such script. I have to change user password for several servers.Would you mind sending me both the scripts at neha.ao@gmail.com ? It would be a great help.
Reply With Quote  
Join Date: Oct 2007
Posts: 1
Reputation: muffin1314 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
muffin1314 muffin1314 is offline Offline
Newbie Poster

Question Re: Change Password In A Shell Script

  #17  
Oct 15th, 2007
Hello AMIT,

I almost need the same script. What I have is a root password which needs to be same on all servers. So these would be the requirements
> Script will have the root password
> The script will change the existing password and will insert the one which I have give
> Later it will ask me to type it from the keyboard to verify it
Do u have such kind off script..It would be great if you can please share it
Sri


Originally Posted by kamitsin View Post
i am using a shell script which changes the password of all the servers in the network and also of the host server (as per your requirement) but it uses except.

Earlier i had a perl script to change the password.

If you want i can give you both the scripts and you can modify them as per your requirement.

Amit
Reply With Quote  
Join Date: Jan 2008
Posts: 1
Reputation: foosballrocks is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
foosballrocks foosballrocks is offline Offline
Newbie Poster

Re: Change Password In A Shell Script

  #18  
Jan 29th, 2008
Amit,
First, THANK YOU for posting the script.

I get the following error when attempting to run this on a SUN box.

Can't open a pseudo-terminal. No such file or directory at ttypasswd.pl line 26.

I'm hoping to change the root password across many servers via a script. This script appears to change the password for the initiating user.

On my target servers, I'll need to su - to the root account since we can't login directly as root.

I have a file that contains that the hostnames for all my target servers and I would like the script to parse this file.

Thank you in advance for any assistance you can provide.
Chris
Reply With Quote  
Join Date: Apr 2008
Posts: 1
Reputation: bjgyking is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bjgyking bjgyking is offline Offline
Newbie Poster

Re: Change Password In A Shell Script

  #19  
Apr 22nd, 2008
hello Amit,

I also need change user password across multiple servers, could you send both of your scripts to bjgyking@163.com.
Your help will be highly apprieciated!!!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 3:24 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC