ssh and passwd scripting execution problems on linux

Thread Tools Search this Thread
Operating Systems Linux ssh and passwd scripting execution problems on linux
# 1  
Old 08-05-2011
ssh and passwd scripting execution problems on linux

I'm having a problem here and I was wondering if anyone could help me? I'm putting together a password script. First off, I don't have root access. I have sudo access. Lets say the User ID is Trevor1, the password is H!rry23! and the server name is Linux1234

This is how the script begins

read -p "Enter User ID"= useridname
read -p "Password"= userpasswd
read -p "Enter Server(s)"= servertext && echo $servertext > serverlist
for i in `cat serverlist`
echo "$i"
ssh $i sudo /usr/bin/passwd --stdin $useridname | echo -n $userpasswd
cat /dev/null > serverlist

Everything goes well until I get to this portion of the script :

ssh $i sudo /usr/bin/passwd --stdin $useridname | echo -n $userpasswd

The the output is:

H!rry23! Enter passphrase for key '/local_home/username/.ssh/id_dsa

After I enter the passphrase key and press enter, the cusor will just sit there forever.

After a long while i'll get this output:

passwd: Authentication information cannot be recovered

What's going wrong? And how can this be fixed

Last edited by pludi; 08-05-2011 at 12:38 PM..
# 2  
Old 08-05-2011
what do you want to do after you ssh?
# 3  
Old 08-08-2011
I want the password echoed into the passwd command.
# 4  
Old 08-08-2011
It's passwd, not echo, that should be reading from the pipe:
$ echo password | passwd --stdin ....

Not sure how that sits with your SUDO rule, though.
# 5  
Old 08-08-2011
I changed the command to :

echo $userpasswd | /usr/bin/passwd --stdin $useridname

and I get this output:

Only root can do that.
Enter passphrase for key '/local_home/username/.ssh/id_dsa':

So, is it safe to assume that I'll need root access to the command passwd?
# 6  
Old 08-08-2011
I have no idea where the 'passphrase for key' came from, usually ssh gives that.

Yes, of course you need to be root to change someone else's password Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ssh passwd less, shell script

Hi All, Wishes!! I need some help to prepare a script to copy the public key from admin host to multiple client hosts to make them login without password. Detailed : I have an admin host "admin1" and i generated sshkeygen, now i have and i have around 50 client hosts. i... (4 Replies)
Discussion started by: kumar85shiv
4 Replies

2. UNIX for Beginners Questions & Answers

Execution problems

How to find a word in a directory which contains many files? i just want to count how many such words are present in all the files? This is the code which i tried for a single file echo "Enter the file name:" read file echo "Enter the word to search:" read word if then echo "The count... (4 Replies)
Discussion started by: Meeran Rizvi
4 Replies

3. Shell Programming and Scripting

Execution problems with scripting

Hi, I am new to scripting.I had one problem infront of me.I tried in many ways with minimal knowledge........Kindly help me. Description: I want a shell script where it has to read an input.txt file and need to remove duplicate lines and the result need to kept in output.txt file. input... (5 Replies)
Discussion started by: bhas
5 Replies

4. Shell Programming and Scripting

Execution Problems

this my source file ************* fixed *************** Begin equipmentId : d9 processor : fox number : bhhhhhh Variable # 1: Id : 100 Type : 9 nType : s gType : 5f mType : 4 LField : England DataField : london Length ... (6 Replies)
Discussion started by: teefa
6 Replies

5. Shell Programming and Scripting

Execution Problems!!

i have been working on this for a about 12 hours today say's end of file un expected any idea's using the bourne shell and its driving me nuts worked fine in bash but prof says make it work in bourne and good luck worth 13% any help would be awesome #!/bin/sh trap "rm mnt2/source/tmp/* 2>... (1 Reply)
Discussion started by: mrhiab
1 Replies

6. Shell Programming and Scripting

Execution problems with grep command in scripting

Hi All, I was looking for grep command option which can exactly matches the word in a file, for examples you may be seeing one word that is also in another word, there might be lkk0lv23 and a lkk0lv234 in which case lkk0lv23 will put BOTH hosts from the grep in. I was using this in a bash... (2 Replies)
Discussion started by: bobby320
2 Replies

7. UNIX and Linux Applications

Execution Problems with Cron

Hi all!! I have a nerve-wracking concept (probably for me!!) which is not understood. My crontab entry looks this way. 33 09 22 3 * /home/ "Bgp4 ALL" >/dev/null 2>&1 But cron gets started occasionally. Sometimes it does. Sometimes it does not. And sometimes it hangs in the middle (I... (1 Reply)
Discussion started by: dhivyasuresh
1 Replies

8. Programming

execution problems with cron

how to store a date into file? and how we can access date from the file? ---------- Post updated at 06:09 AM ---------- Previous update was at 06:08 AM ---------- how we can store date in file? (1 Reply)
Discussion started by: causalmodi777
1 Replies

9. Shell Programming and Scripting

Expect passwd scripting

I am trying to write an expect script which will read information from a file that contains username and password, and change the password for each user accordingly. The list contains around 100 users. I am new to both Solaris and expect. I have successfully been able to set the first user's... (9 Replies)
Discussion started by: DoctorOctagon
9 Replies

10. BSD

passwd problems

All of a sudden, this FreeBSD box stopped letting people login. Does anyone have any idea why? And how would I go in and verify the integrity of the passwd and shadow file, ( i know jack about freebsd, i dont even see a shadow file on the testbox i just installed.) any ideas would be great.... (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies
Login or Register to Ask a Question