automating ssh session with password


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting automating ssh session with password
# 1  
Old 06-20-2008
automating ssh session with password

Hi
Can anyone help me in automate a ssh session with password using shell script
# 2  
Old 06-20-2008
You'll want to look into using keys-based authentication instead of passwords.

OpenSSH Public Key Authentication
# 3  
Old 06-20-2008
also you can take a look at "expect", which is pretty simple to do interactive job under unix.

link for expect Expect - Expect - Home Page
# 4  
Old 06-23-2008
Data

thanks for replying but the problem is i have a shared home folder between two servers and my write access is also within the home folder. So i need to ssh some commands from one server to the other without asking for password or automatically providing the password.
# 5  
Old 06-23-2008
Quote:
Originally Posted by raghav288
thanks for replying but the problem is i have a shared home folder between two servers and my write access is also within the home folder. So i need to ssh some commands from one server to the other without asking for password or automatically providing the password.
Did you actually try what the others said? Public key authentication should do what you want. When you don't set a passphrase while setting up public key authentication, it won't ask for one when you remotely connect.

so when you do:

Code:
ssh test@testserver.com

You will get to the home folder of the user you logged into on the remote server, without the need of providing a password.
# 6  
Old 06-23-2008
Hi dejavu
Public key authentication does not work since the home folder is shared between the servers, so when u run the keygen command, it creates the .ssh folder on the home folder and it replicates on the other server too. So when i tried to create a authorized_keys folder and put the public key, it again replicates, and so it dint work

So i need to automate the password reply....
# 7  
Old 06-23-2008
The public key thing soes not work bcos of the shared home folder... when you run the keygen command, a .ssh folder will be created, but since it is shared the same is created on the other server too... and when i tried to create a authorized_keys folder and put the public key file, it is replicated in the source server too... so this dint work... So is there any way to automate this process even with password in the script ... the problem is i have write access only on my home folder, which is shared between the two servers.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Automating UNIX/Solaris password resets

Hi, we are running solaris 5.10 and looking for solutions to automate password resets? Plz assist. Thanks, Sridhar (6 Replies)
Discussion started by: chvgms
6 Replies

2. Shell Programming and Scripting

Automating ssh connection

I want to create a script for the ssh connection that handles any input. Be it IP or DNS. And instead of typing in giant commands, I'd like to downplay it and treat it. I imagined the following command: i machine or i machine.exemple.com.fr or i 111.222.333.4444 Login attempts should... (5 Replies)
Discussion started by: developy
5 Replies

3. AIX

SSH session closes after typing correct password

hi guys need some help. when ever i'm login ssh to aix server session always closed. when trying t0 type wrong password the session still continues, but we tried the correct password it automatically ends. what could be the problem to this please see .profile details ... (6 Replies)
Discussion started by: bocha
6 Replies

4. UNIX for Advanced & Expert Users

Automating Interactive password change

I have written the below scripts . ldap_pwd_prompt.ksh #!/usr/bin/ksh passwd -r ldap interactive_pwd_change.exp #!/usr/local/bin/expect set timeout 10 set curpass set newpass spawn ./ldap_pwd_prompt.ksh expect "Enter existing login password:" send "$curpass\r" expect "New... (6 Replies)
Discussion started by: dr46014
6 Replies

5. AIX

Users kicked out after changing their password in an ssh session

Hi I have experienced this for years and just put up with it. However a client of mine now wants to stop this happening to their users. I have scoured the internet but can find no reference to the problem. I tried switching to PAM authentication thinking this might help but it made no... (6 Replies)
Discussion started by: johnf
6 Replies

6. HP-UX

ssh session getting hung (smilar to hpux telnet session is getting hung after about 15 minutes)

Our network administrators implemented some sort of check to kill idle sessions and now burden is on us to run some sort of keep alive. Client based keep alive doesn't do a very good job. I have same issue with ssh. Does solution 2 provided above apply for ssh sessions also? (1 Reply)
Discussion started by: yoda9691
1 Replies

7. Shell Programming and Scripting

could not send commands SSH session with Net::SSH::Expect

I am using Net::SSH::Expect to connect to the device(iLO) with SSH. After the $ssh->login() I'm able to view the prompt, but not able to send any coommands. With the putty I can connect to the device and execute the commands without any issues. Here is the sample script my $ssh =... (0 Replies)
Discussion started by: hansini
0 Replies

8. Shell Programming and Scripting

automating username / password entry

I have a database that contains a list of server names, and the password for the root user on several servers (100+). I need to verify the passwords for each of the servers in an automated fashion because the database continues to grow. All of the users that I'm going to test are ROOT. I can't... (1 Reply)
Discussion started by: jbeck22
1 Replies

9. UNIX for Dummies Questions & Answers

Automating password change

Hi, I'm trying to create a shell to change some user password with random string. I've tried to use stdin redirection to supply the new password by a response file: passwd theuser < respfile but I continue to be prompted for supplying pwd via console keyboard. Can you help me to... (2 Replies)
Discussion started by: nisant
2 Replies

10. Shell Programming and Scripting

automating password ?

Hi all, I want to write a script which logs into a database (DB2). To do this i need to have a password. This will be done lots and lots of times, so i need to modify the script to automate the response to the password request. How do i this, because at present i do the following: db2 connect... (3 Replies)
Discussion started by: Liamo
3 Replies
Login or Register to Ask a Question