Connect to one server from other server without asking password


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Connect to one server from other server without asking password
# 1  
Old 03-07-2014
Connect to one server from other server without asking password

Hi ,
I am using redhat linux 5.I.I need a command or script which need to login from one server to another without asking password.This can be done even providing password on the command line is also fine.I have tries sshpass but it didn't work.ssh key generations is not preferred here.

please help me on this if it can be done in any other way.
# 2  
Old 03-07-2014
In what way did sshpass "not work"?

Moderator's Comments:
Mod Comment Posting "Does not work" without explanation does not help you or anyone. If a command does not work for you, please show the exact circumstances you used it, and the exact error or malfunction you received. Do not paraphrase errors, or post the text as links, images, or attachments if you can avoid it: Paste the exact message, in code tags, like [code] text [/code] or by selecting the text and using the Image button.

Thank you.

The UNIX and Linux Forums
# 3  
Old 03-07-2014
expect can drive in the ssh password, or scripts like it that capture the ssh tty to stdin. There are many other sorts of servers you can set up to do specific tasks, like https web. There may be ways to do the remote tasks locally (nfs) or more indpendently (cron). The normal solution is ssh trust using PPK. Who says that is bad? Scripting a password is pretty universally considered worse!
# 4  
Old 03-07-2014
Thanks for your replies.Finally i am able to connect to the destination server wihtout asking password by below command.

sshpass -p 'password' ssh -o StrictHostKeyChecking=no root@serverip.

but now i want to execute a command as below and i want to pass this one as a parameter to the command above.could u pls help on this.

isi_for_array -s "isi auth ads time --sync --force"

so this isi command i want to provide the input to the sshpass command.how can i do that?
# 5  
Old 03-07-2014
Append the command, eg:
Code:
sshpass -p pass123 ssh -o StrictHostKeyChecking=no root@1.1.1.1 "echo 123"

--ahamed
# 6  
Old 03-08-2014
Hi thanks for your reply.I tried that option but this time it is not even connected to the destination server with below approach.It is able to login with normal sshpass command.My whole purpose here is source is a server and destiantion is storage.I want to run a cron on server which connect to the storage and runs the command mentioned in the post below.

output of the command here isicommand as a parameter is:

[sanadmin@server1 ~]$ sshpass -p 'password' ssh -o StrictHostKeyChecking=no root@storageip "echo isi_for_array -s "isi auth ads time --sync --force""
isi_for_array -s isi auth ads time --sync --force
[sanadmin@server1 ~]$

I am not sure whether command was successful or not.But it appears to me it not.
# 7  
Old 03-08-2014
You should not echo it, what i gave was an example.Try this...
Code:
sshpass -p 'password' ssh -o StrictHostKeyChecking=no root@storageip 'isi_for_array -s \"isi auth ads time --sync --force\" '

--ahamed

Last edited by ahamed101; 03-08-2014 at 04:10 AM.. Reason: Updated command
This User Gave Thanks to ahamed101 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

How to connect Linux server (configure two way authentication) with Windows server?

Hi my name is Manju. ->I have configure the two way authentication on my linux server. ->Now I am able to apply two way authenticator on particuler user. ->Now I want to map this linux server to my AD server. ->Kindly tell me how to map AD(Active Directory) with this linux server. ... (0 Replies)
Discussion started by: manjusharma128
0 Replies

2. HP-UX

Connect to remote server using sftp with password define within command/script

I am trying to connect to remote server in hp-ux, using sftp command (using sftp username@ip and password ) able to connect to remote server but, in this case sftp prompt for password and user need to manually enter it. I want sftp can read a password define in script or from file, so it can... (1 Reply)
Discussion started by: ketanraut
1 Replies

3. Shell Programming and Scripting

Connect to server-1 from server-2 and get a file from server-1

I need to connect to a ftp server-1 from linux server-2 and copy/get a file from server-1 which follows a name pattern of FILENAME* (located on the root directory) and copy on a directory on server-2. Later, I have to use this file for ETL loading... For this I tried using as below /usr/bin/ftp... (8 Replies)
Discussion started by: dhruuv369
8 Replies

4. Shell Programming and Scripting

Connect (SSH) to Windows server via Linux server through a script and passing command.. but failing

I am trying to connect to Windows server via Linux server through a script and run two commands " cd and ls " But its giving me error saying " could not start the program" followed by the command name i specify e g : "cd" i am trying in this manner " ssh username@servername "cd... (5 Replies)
Discussion started by: sunil seelam
5 Replies

5. UNIX for Advanced & Expert Users

Public key to connect from one ftp server to other server

How to generate public key to connect from one ftp server to other server to use in scripting. (1 Reply)
Discussion started by: sridhardwh
1 Replies

6. Linux

Generate public key to connect from one ftp server to other server

How to generate public key to connect from one ftp server to other server to use in scripting. (0 Replies)
Discussion started by: sridhardwh
0 Replies

7. Shell Programming and Scripting

Connect to Server B from Server A and Archive the file

Hi I need to connect to a ServerB from Server A eg: Server A : 172.20.273.51, un: xxx, pwd: xxx Server B: 172.20.273.51, un:yyy, pwd: yyy Need to copy the files(with name starts with IME*) from /grid/pc/IME* to /grid/pc/archive What will be the command or script to... (3 Replies)
Discussion started by: vsmeruga
3 Replies

8. Shell Programming and Scripting

[SSH] Need to connect to remote server as different user and without password

I have a task requiring that USER_A run a script, which connects to HOST_B as USER_B and does not ask for a password. If I am logged in on HOST_A as USER_B, I can connect to HOST_B without a password, no problem. However, if I try running ssh with the command line "ssh USER_B@HOST_B" while... (3 Replies)
Discussion started by: Totengraber
3 Replies

9. Shell Programming and Scripting

connect to remote server by applying password

Hi , I am new to shell script. I have to write a shell script which will login to remote server then check for the space there. There 50 remote ervers all are having different password. Could you please suggest me some way. I am working on solaris box. Thanks in advance (2 Replies)
Discussion started by: vikash_k
2 Replies

10. Windows & DOS: Issues & Discussions

To Connect to Windows server from Unix server

Hi i am writing a script in unix where after some validations, i require the script to connect to a windows server and then kich off a batch file there. i tried ftp and got the error message that "the remote host refused an attempted connect operation". I am able to connect to this unix... (4 Replies)
Discussion started by: vidzz911
4 Replies
Login or Register to Ask a Question