How to automatically enter password in a script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to automatically enter password in a script?
# 1  
Old 04-07-2015
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 user account to monitor ).

Can someone help me please SmilieSmilieSmilie

Last edited by bobochacha29; 04-07-2015 at 06:08 AM..
# 2  
Old 04-07-2015
Use ssh-keygen. Google or seach within the forum for more details.
This User Gave Thanks to clx For This Post:
# 3  
Old 04-07-2015
Quote:
Originally Posted by clx
Use ssh-keygen. Google or seach within the forum for more details.
As I said above, the authentication keys doesn't work in this case ( actually it's because of the limit of the OS and some security reasons )
# 4  
Old 04-07-2015
For security reasons, it would make sense to enable ssh and not enforcing plaintext passwords in scripts, as THAT is a higher risk, due to the passwords beeing readable by everyone!
Specialy, since you want to ssh on your server...

Just my 2 cents.
This User Gave Thanks to sea For This Post:
# 5  
Old 04-07-2015
Quote:
Originally Posted by bobochacha29
As I said above, the authentication keys doesn't work in this case ( actually it's because of the limit of the OS and some security reasons )

Ah, I missed that point. You mentioned there is no option to use those! What issues you facing?

Apart from ssh-keygen, you can use expect.
This User Gave Thanks to clx For This Post:
# 6  
Old 04-07-2015
Quote:
Originally Posted by sea
For security reasons, it would make sense to enable ssh and not enforcing plaintext passwords in scripts, as THAT is a higher risk, due to the passwords beeing readable by everyone!
Specialy, since you want to ssh on your server...

Just my 2 cents.
Because of the limit of the OS version of the server ( which can not update to a higher version ) I want to ssh, I can not ssh without password to that server by an user account ( it requires admin account ). If I could done it, I would have done it already.

So please stop talking about the ssh-keygen. SmilieSmilieSmilie

---------- Post updated at 04:51 AM ---------- Previous update was at 04:46 AM ----------

Quote:
Originally Posted by clx
Ah, I missed that point. You mentioned there is no option to use those! What issues you facing?

Apart from ssh-keygen, you can use expect.
Could you show me detail code, because I found some examples using expect, but it seems not work SmilieSmilieSmilie. Thank you
# 7  
Old 04-07-2015
Assuming that you are not using ssh at all, can I presume that rlogin would be allowed? You can grant (for a given user) the source addresses that can rlogin to it without further credentials being required.


Does that offer an option? I would try to avoid expect if possible because of the risks and complexities that it introduces.




Robin
This User Gave Thanks to rbatte1 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script that automatically issue "yes" and press enter

Team, Got a thousand servers. I created a script to say hello on every server. But is there a script or whatever that will issue a yes on every key checking. for i in `cat myserverlist` do echo $i ssh-copy-id $i done The authenticity of host 'server1 (162.162.0.10)' can't be... (7 Replies)
Discussion started by: invinzin21
7 Replies

2. Shell Programming and Scripting

Automatically enter input in command line

Hi, This is a script which to create an opvn user, I want which answer automatically to a certain part so, I try this, it works without the red part but I must type manually.. : #!/bin/bash ## Environnement ## LC_ALL=C ## Paths ## rsa_dir="etc/openvpn/easy-rsa"... (10 Replies)
Discussion started by: Arnaudh78
10 Replies

3. Shell Programming and Scripting

Input password to bash script, save, and enter when needed

I am looking for a way to start a script and have it prompt for a password that will be used later on in the script to SSH to another host and to SFTP. I don't want the password to be hard coded. Below is my script with the actual IP's and usernames removed. #!/usr/bin/expect -f... (2 Replies)
Discussion started by: jbrass
2 Replies

4. 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

5. 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

6. 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

7. Shell Programming and Scripting

enter password at prompt during a script?

I'm using rsync with the "-e ssh" option so of course it asks for a password using a prompt. Is there a way to tell a script to expect a prompt, wait for it, and give a password when it arrives? There is a way to give rsync a password as part of its options using a file, but it only works with... (2 Replies)
Discussion started by: davidstvz
2 Replies

8. Shell Programming and Scripting

How to enter a password in the script automatically when prompted?

Hi Friends, We need to create a script which will invoke a command with diffrent parameters. The command invoked needs the password. So how automatically we can enter password in the script to the command? example.: #!/bin/ksh for par in `cat parfile` do # Here is the main command... (1 Reply)
Discussion started by: sourabhsharma
1 Replies

9. 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

10. UNIX for Dummies Questions & Answers

How would I telnet & change user password automatically in a script

I would like to create a script that logs into a list of several servers 50+ and changes my password all at once. Every 60 days we are required to login to each system and change our passwords or else they expire and our login account is deleted. I have an idea on how I could do this but... (4 Replies)
Discussion started by: darthur
4 Replies
Login or Register to Ask a Question