shange user's pass for all services on a remote host


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shange user's pass for all services on a remote host
# 1  
Old 02-17-2005
shange user's pass for all services on a remote host

here is the picture:
a website on server1 & a "username" logged in that site.
The same username has a shell(nologin)/ftp/samba/mail(qmail) acount on server2.
i have s form on server1 that can pass the username & its NEW password to a sript that should change all passwords on server2.

the script must be executed as root on server2, as you can't do "vpasswd username@domain.com" as nonroot.

Thought of expect to do this, but just cant put it all together.
----
server1> ssh root@server2
passwd username
/home/vpopmail/bin/vpasswd username@domain.com
exit
send back result as "success" or "failed"
----
hope you guys can help
# 2  
Old 02-17-2005
update

http://sarg.sourceforge.net/chetcpasswd.php
This might be what i need, but still will appreciate other sugestions
regards
# 3  
Old 02-17-2005
I'm not sure I follow your question, but here is a script to look at...

changepass automate password changes on multiple systems
# 4  
Old 02-18-2005
more details:
i have shell (bash) access to that RedHat linux and have the root password.

What i need is a simple script to take user+pass & do
/usr/sbin/chpasswd $1:$2
/home/vpopmail/bin/vpasswd $1@domain.com $2

Just my scripting is very bad and must do it before i have time to learn Smilie
# 5  
Old 02-22-2005
at last :)

Again RTFM did the trick Smilie
The following tool just watches your input in the console & generates the script for you. Enjoy it!
http://expect.nist.gov/example/autoexpect.man.html
http://expect.nist.gov/example/autoexpect
# 6  
Old 02-23-2005
not quite there

here is my "remote change passwd" script:
----------
#!/usr/bin/expect -f
#
set force_conservative 0
#
set timeout 1
spawn ssh root@srv
match_max 100000
expect "Last login: *\r\r
\]0;root@srv:~\[root@srv root\]# "

send -- "passwd USR\r"
expect "passwd*\r
Changing password for user *.\r
New password: "
send -- "PWD\r"
expect -exact "\r
Retype new password: "
send -- "PWD\r"
expect -exact "\r
passwd: all authentication tokens updated successfully.\r
\]0;root@mail:~\[root@mail root\]# "

send -- "/home/vpopmail/bin/vpasswd USR@domain.com\r"
expect "/home/vpopmail/bin/vpasswd *\r
Please enter password for*: "
send -- "PWD\r"
expect -exact "\r
enter password again: "
send -- "PWD\r"
expect -exact "\r
\]0;root@mail:~\[root@mail root\]# "

send -- "exit"
....
--------------------
This works great if I fill the values for USR & PASS in the script.
How can I pass these from the command prompt like:
#./myscript.exp USR PASS
and make the script use these

Thank you for the support
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check/get the exit status of a remote command executed on remote host through script

Geeks, Could you please help me out in my script and identify the missing piece. I need to check/get the exit status of a remote command executed on remote host through script and send out an email when process/processes is/are not running on any/all server(s). Here's the complete... (5 Replies)
Discussion started by: lovesaikrishna
5 Replies

2. Shell Programming and Scripting

Pause processes in remote host and resume execution in another remote host

Hi, Given addresses of 2 remote machines, using a shell script is it possible to get the state of running processes in "src" stop all the processes in "src" exit out of "src" ssh into "dest" resume the state of executing processes captured in step 1 in "dest" Assumption: "src" is... (3 Replies)
Discussion started by: Saeya Darsan
3 Replies

3. Shell Programming and Scripting

How to pass a variable from one host to another host

Hi , I have to pass a string through a variable from one host to another. Is that any any way to do it . Please help me (4 Replies)
Discussion started by: arukuku
4 Replies

4. Shell Programming and Scripting

AIX ksh: how to pass variable to host shell

I have a script that "runs" a script. For example: ./runscript.ksh pcnmc01.ksh runscript puts pcnmc01.ksh into the background with log output going to the logfile. After executing the command, I get this output: Running script in the background: pcnmc01.ksh Logfile:... (2 Replies)
Discussion started by: Eben Yong
2 Replies

5. UNIX for Advanced & Expert Users

Help! How to find the local host after few ssh hops to remote host???

I do a ssh to remote host(A1) from local host(L1). I then ssh to another remote(A2) from A1. When I do a who -m from A2, I see the "connected from" as "A1". => who -m userid pts/2 2010-03-27 08:47 (A1) I want to identify who is the local host who initiated the connection to... (3 Replies)
Discussion started by: gomes1333
3 Replies

6. Shell Programming and Scripting

running commands to remote host from centralized host

Gurus/Experts We have a centralized UNIX/Solaris server from where we can actually ssh to all other UNIX/Solaris servers...I need to write a script that reside on this centerlized server and do FileSystem monitoring (basically run df -h or -k) of other remote servers and then send an email to me... (6 Replies)
Discussion started by: anjum.suri
6 Replies

7. Shell Programming and Scripting

Run a shell script from one host which connext to remote host and run the commands

I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
Discussion started by: SN2009
6 Replies

8. Solaris

Remote services during Solaris installation

I've installed Solaris 10 (05-08) on a SPARC platform During the installation I was prompted with the question below. I selected yes to enable remote services. Does anyone know what services this option enables? - Enabling remote services ---------------------------------------- Would... (6 Replies)
Discussion started by: soliberus
6 Replies

9. Solaris

How to delete the files from local host to remote host

Hi all, i am copying .gz files from production server to development server using "scp" command.my requirement is after copying .gz files i want to delete old .gz files(two days back) in development server from production server. like this way i need to delelte .log ,.z and .dmp files... (3 Replies)
Discussion started by: krishna176
3 Replies

10. UNIX for Dummies Questions & Answers

How to specify the remote host?

Hi, I want to compare 2 set of dierectories, one is current host, other in remote, I am tring like this: diff $HOSTTOBACKUPH:$SOURCEHR $DR_BACKUP_DIR_H/hourly.0 I am getting fowlling error> diff: ctlrws123:/home/arbuser/temp2/mscdr/sor_d: No such file or directory how to specify the... (2 Replies)
Discussion started by: redlotus72
2 Replies
Login or Register to Ask a Question