Can't solve a simple SSH/scp issue.. Please help.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Can't solve a simple SSH/scp issue.. Please help.
# 1  
Old 10-21-2014
Code Can't solve a simple SSH/scp issue.. Please help.

Disclaimer: I tried searching but wasn't able to get to the answer so please don't flame.

Scenario:
I have a root script that generates a file on box1 and then needs to scp it over to box2 using user1. Both boxes are running open-ssh.

root@locat-host# scp /tmp/file1 user1@box2:/tmp/file1

Problem:
When I scp directly from user1 (user1@box1# ssh box2) -- all is good.
When I scp from root user (root@box1# ssh user1@box2) -- I am prompted for a password.

local-host key located: /home/user1/id_rsa.pub
remote-host auth located: /home/user1/authorized_keys

Is my key placement off?

- Thanks
# 2  
Old 10-21-2014
The identity of root at box1 probably isn't in the authorized_keys file for user1@box2.

Try running, as root on box1:

Code:
ssh-copy-id user1@box2

# 3  
Old 10-21-2014
The public key must be appended to the $HOME/.ssh/authorized_keys in this case /root/.ssh/authorized_keys, at the remote server.
# 4  
Old 10-21-2014
@achenle -- ksh: ssh-copy-id: not found
Box1 = AIX
Box2 = RHEL

@Aia -- don't have access to root on remote box
# 5  
Old 10-21-2014
ALso on the receiving system, /etc/ssh/sshd_config has to have
Code:
PermitRootLogin yes

Which is not the default setting.
# 6  
Old 10-21-2014
Following command should help you to copy the file with root user over user1's ssh keys. In fact you'll temporarily switch to user1 and run that scp command.
Code:
su -c "scp /tmp/file1 user1@box2:/tmp/file1" user1

# 7  
Old 10-21-2014
Quote:
Originally Posted by denissi
@Aia -- don't have access to root on remote box
I thought you wanted to login as root, but now I think I see what you want.
You are are root in your local box and want to login as an user1 to remote, if so, your public key as root in the local machine, must be appended to your urser1 account $HOME/.ssh/authorized_keys in the remote.
That file, by the way, needs to have permission 600.

Last edited by Aia; 10-21-2014 at 10:03 PM..
This User Gave Thanks to Aia For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

How to solve TCP connection timeout (not in ssh)?

HI We have some Red Hat Linux Sevres which is having TCP connection timeout, not SSH connection, as an example oracle connection connected from TOD. SSH i managed to add keepalive and it's working fine (1 Reply)
Discussion started by: bentech4u
1 Replies

2. Shell Programming and Scripting

How to solve hang issue in script?

i have one function block in the beginning of my script and there are some commands inside that function which will perform some operations. And i am invoking that function from my main script by passing some values. Sometimes it is hanging in the middle for some value. For example: For 1st... (3 Replies)
Discussion started by: thomasraj87
3 Replies

3. Programming

Removed /root/.cabal by mistake - how to solve this issue?

I have mistakenly removed /root/.cabal/ from my root directoty and when I tried to reinstall it I get this output: faiz:~$ sudo cabal install pandoc --reinstall Resolving dependencies... In order, the following will be installed: pandoc-1.14.0.4 (reinstall) Warning: Note that reinstalls are... (3 Replies)
Discussion started by: faizlo
3 Replies

4. Shell Programming and Scripting

Request to checkVenn diagram issue solve by Unix programm

Hello Any Unix programm can help me to solve thsi issue: I have 2 venn digrams please checke the attached file for pictures of venn diagram for eg red is A yellow is B and green is C..Please see attached file for Venn diagrams In one ..... I have 3 data set A , B and C Venn diagram... (0 Replies)
Discussion started by: manigrover
0 Replies

5. UNIX for Dummies Questions & Answers

Simple Problems to Solve!

Hi, I'm pretty poor at using UNIX but I'm learning. Please help me with these simple problems! Much appreciated! 1. I've changed my shell from bash to csh but I prefer bash. How do I change back? I've tried using chsh -s but it's not working! 2. I'm trying to download TopCat. I've done... (2 Replies)
Discussion started by: SimonWhite
2 Replies

6. Shell Programming and Scripting

simple scp script

simple bash script to scp specific file to another server example: /etc/dir1 (specific file name) then you will just execute a keyword.. sample: ./scp.sh atm*. where atm*. is a sample keyword to search) thanks (0 Replies)
Discussion started by: lhareigh890
0 Replies

7. UNIX for Dummies Questions & Answers

Can anyone solve this awk issue ?

awk -F^ '{ if (($1 != "X") && ($5 != "3")) || if (($1 != "S") && ($5 != "2")) print $0}' abc> xyz The above command returns this error awk: syntax error near line 1 awk: illegal statement near line 1 I am newbie to awk, Any awk intelligence involved in correcting this issue is highly... (2 Replies)
Discussion started by: karthickrn
2 Replies

8. Solaris

please help me solve this issue.........

Hi, I am having a Solaris 5.9 server in which an audit trail script is running every day.It is doing nothing but taking the backup of three files given below -rw-r--r-- 1 root root 1807 May 18 01:30 login_server1_17May2008 -rw-r--r-- 1 root root 0 May 18 01:30... (5 Replies)
Discussion started by: Renjesh
5 Replies

9. Solaris

Help me to solve this issue

Hi, I want to send a .tar file from one solaris 5.9 server to another server in order to make files in sync.What method i can use? (2 Replies)
Discussion started by: Renjesh
2 Replies

10. UNIX for Dummies Questions & Answers

Simple Windows-to-Unix SCP question

Hi, I am fairly new to Unix. My school computers have only UNIX installed on them, and I wish to use them to do some parallel computing. To do so, I need to transfer the files from my Windows computer to my Unix account on a different computer. I am using the SSH login with the Putty client.... (2 Replies)
Discussion started by: Duchesne
2 Replies
Login or Register to Ask a Question