ssh -t answering automatically to the password


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ssh -t answering automatically to the password
# 1  
Old 11-04-2011
ssh -t answering automatically to the password

hi,

i'm using the folowing ssh command to list the newuser "crontab' from myuser

Code:
ssh -t myuser@host1  "sudo -u newuser crontab -l"

this is ok but it is asking me a password.

Code:
Mot de passe de myuser:

The problem is that i want to answer it automatically in a shell script with the password entered previously.

i tried with
Code:
echo "password| ssh......

or
Code:
ssh -t......... << _EOT_
password
_EOT_

it doesn't work

Somebody has an idea ?
regards
Christian
# 2  
Old 11-04-2011
why not let myuser use sudo without passwd then? (configure in sudoers...)
# 3  
Old 11-04-2011
well i'm just a user not an admin , i can't ask to change "sudoers"

i would just catch the question "
Code:
Mot de passe...

."
and answering it.

thanks
Christian
# 4  
Old 11-04-2011
Who is asking the passwd? the ssh session? If so the sudo will ask one too just after...
# 5  
Old 11-04-2011
The "ssh session " is asking the password once.

but i need to answer it automatically with the script because i chain many ssh commands

Christian
# 6  
Old 11-04-2011
Quote:
Originally Posted by Nicol
well i'm just a user not an admin , i can't ask to change "sudoers"
ask the admin to change sudoers, then.

If they're not willing to let you do that, they'll be even more horrified at you kludging in insecure plaintext passwords.
# 7  
Old 11-04-2011
And what do you do about sudo then?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to automatically enter password in a script?

Hi I'm working with AIX 6.1 I would like to ssh to a server without entering password ( to monitor something) but there's no way to do that by authentication keys, so I need to write a script which can ssh to that server without entering password ( no need to hide passsword in the script, just an... (9 Replies)
Discussion started by: bobochacha29
9 Replies

2. Shell Programming and Scripting

In put password automatically to sftp command

Hi all, i have to sftp a file to another server I don't have "expect" or sshpass on my machine its solaris 10, i want to pass password in command line or after doing this sftp user@server how to automatically provide the password as input ( stored in some variable or so) ... (1 Reply)
Discussion started by: zozoo
1 Replies

3. Shell Programming and Scripting

Shell Script to Automatically Read My Password

I have a shell script to run set of commands every week . I dont have a root access on the server but I can run the commands using pbrun cat myscript.sh * * * pbrun command.... each time I run the script , it asks me for my password then it executes fine. ./myscript.sh Password... (7 Replies)
Discussion started by: Sara_84
7 Replies

4. Shell Programming and Scripting

Script to automatically enter a password

I need to retrieve thousands of lines of information from hundreds of nodes. Each node requires a passowrd in order to retrieve the information. Fortunately, the password is the same for each one of them. So I am trying to come up with a script that would allow me to include the password so I can... (0 Replies)
Discussion started by: Ernst
0 Replies

5. UNIX for Dummies Questions & Answers

how to enter hardcoded password automatically

In the script i am passing a command from script which is called from cron. When this command is called from cron the unix prompt asks for password. Can we automatically enter the password when promted(if the password is hardcoded in script)?? Please let me know how to enter the password... (4 Replies)
Discussion started by: abhi_n123
4 Replies

6. Shell Programming and Scripting

Change root password automatically

I need to change root password automatically in some servers all three months. I want to run this process in one of the servers and reply it to the others. The password must be known by the administrator. (3 Replies)
Discussion started by: Alrica
3 Replies

7. Shell Programming and Scripting

automatically create password and expand it to other servers

I´m a new system administrator. I have to create a script to put in crontab to change periodically root password and didtribute it to other servers. I searched the posted threads but I didn't find my answer. I would like to do this using ssh and trusted keys. Can anyone help me? Thanks. Aldina (0 Replies)
Discussion started by: Alrica
0 Replies

8. Shell Programming and Scripting

Is there a way to automatically prepopulate a password field?

I want to know if there is a way that I can right a script that will su to root and prepopulate the password field? (6 Replies)
Discussion started by: chrchcol
6 Replies

9. Shell Programming and Scripting

Perl: answering automatically to install questions

Hi everybody, I have been looking for an answer to this issue both on google and on the forum, but I couldn't find anything. please help me :eek: As part of an automated (in perl) install of Solaris 9, I would like to be able to answer automaticaly to the question the installer asks.... (2 Replies)
Discussion started by: zaap
2 Replies

10. Shell Programming and Scripting

Script to automatically change password.

I want to write a script which will automatically take password sequentially from a file after every 10 days. i.e the passwd command should be executed automatically every 10 days and it should take the input from the password file sequentially. Has any1 got a solution?????????????? (1 Reply)
Discussion started by: rahulrathod
1 Replies
Login or Register to Ask a Question