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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [SSH] Need to connect to remote server as different user and without password
# 1  
Old 02-03-2010
Error [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 logged in as USER_A, it asks for USER_B's password on HOST_B.

What am I doing wrong? Is there a way around this?

Thanks,
Todd
# 2  
Old 02-03-2010
you have to do the ssh key mechanism set for USER_B.
# 3  
Old 02-03-2010
Actually, it looks like I figured this out. It seems if I put the public key from USER_A into USER_B's authorized_hosts, it works. However, my real issue is I have users A-Z who all need to connect to HOST_B as USER_B. Would I just need to copy USER_A's public key to USER_B-USER_Z's .ssh directory for that to work?

Thanks!
# 4  
Old 02-03-2010
Quote:
Originally Posted by Totengraber
Actually, it looks like I figured this out. It seems if I put the public key from USER_A into USER_B's authorized_hosts, it works.
Quote:
However, my real issue is I have users A-Z who all need to connect to HOST_B as USER_B. Would I just need to copy USER_A's public key to USER_B-USER_Z's .ssh directory for that to work?

Thanks!
If the first works, you can. Else you need to proceed to the key exchange as USER_B and then copy the key from USER_B to other users who will need to ssh USER_B@SERVER.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies

2. Ubuntu

Run a script at remote server without ssh password

Hello, What I want to do is to run a file on remote server by running a script at localhost but script should not ask ssh password of my remote server when script is executed. Scenario1: To copy files from server2 to data server:$ scp -r root@server2_ip:/var/www/html/*.* /var/ When I enter... (6 Replies)
Discussion started by: baris35
6 Replies

3. Shell Programming and Scripting

How to run commands on remote server using ssh password less authentication?

Hi, I need to run a script located in a directory on remote server by using ssh authentication from my local unix server. Can anyone help me in this. I have tried the below command. It worked for echo command but when i tried to open a file using cat command it is showing "cat: cannot open... (6 Replies)
Discussion started by: ssk250
6 Replies

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

5. Red Hat

unable to connect remote server using ssh

hi all i am unable to connect remote server using ssh but i am able to ping the server ssh service is running. (5 Replies)
Discussion started by: nikhil kasar
5 Replies

6. Shell Programming and Scripting

How to give user name and password in a single command to login to remote server

Hello All, I'm new to unix and i need the below favour from you. I have list of 50 unix server. I need to login to all the server one by one and with the same user and password. I will declare the user name and password globally in the script. for example : servername- hyperV user name... (4 Replies)
Discussion started by: Hari A
4 Replies

7. UNIX for Dummies Questions & Answers

ssh to remote machine with 2nd user and password

Hi all, Really hope someone can help me, i have been trying lots of things and just cant seem to nail it - and for something that seems straight forward.... Anyway, scenario is I need to log onto a second machine (remote server) from main workstation. Once logged in I need to run a batch... (2 Replies)
Discussion started by: Hopper_no1
2 Replies

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

9. UNIX for Dummies Questions & Answers

No password ssh connect to different user

I am trying to create a batch script to securely copy (scp or sftp) files from one machine to another. Unfortunately the files are owned by a different user than the one on my local machine. I have already done a keygen and moved the public key to the authorized_users file of the user on the... (2 Replies)
Discussion started by: PSDba
2 Replies

10. Shell Programming and Scripting

shell script for how to connect to a remote server by using ssh

i want to connect to a remote server through ssh. i have to also provide password within that script. after connecting to the remote server i want to do some operations like grep,cd etc can u pls help me to wite a script. Thanks (1 Reply)
Discussion started by: millan
1 Replies
Login or Register to Ask a Question