LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2011, 05:16 AM   #61
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12

if i put everything in the same script it would become (nederlands: onoverzichtelijk) hard to review.
So we decided to split the testscript and mainscript apart
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-28-2011, 05:27 AM   #62
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
i have an idea:

if i do another ssh keyswap (but now i start on the remote server) and when i found a warning/error in a file, i put this in a logfile.
and then i copy this file with scp from the remote to the local server. and then i check the logfile

let's try that
 
Old 03-28-2011, 06:37 AM   #63
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
hmm this is strange..

i did a ssh key swap again (like one in the first post of this thread) and it fails, i mean, i still need to log on everytime...
i've followed the steps he described (but then starting from the other server) and it fails...

is it because theire is already a key that it fails? or is it something else?
 
Old 03-28-2011, 07:04 AM   #64
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

You don't need to copy 'from' the remote server 'to' your computer. You can just use scp reversed like this:
Code:
scp user@host:/path/to/file/filename .
will copy the file 'filename' to the location where you execute the command, using your key as set up before. No need to generate keys on the other side to obtain this.

Kind regards,

Eric
 
Old 03-28-2011, 07:08 AM   #65
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
ok i'll try it.
If i get it right, the user and host you need to fill in is from the local host?

Last edited by brownie_cookie; 03-28-2011 at 07:16 AM.
 
Old 03-28-2011, 07:10 AM   #66
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

Nope, you provide the user/host combination of the server you're going to connect to. If you want to upload a file with scp you use this:
Code:
scp filename user@host:/path/to/upload
If you want to download a file you use this:
Code:
scp user@host:/path/to/download/filename . (or path where you want to save the file to)
In both occasions you have to authenticate to the remote server, not your local machine.

Kind regards,

Eric
 
Old 03-28-2011, 07:12 AM   #67
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
ok thx; i'll try it (didn't saw the difference )
 
Old 03-28-2011, 07:21 AM   #68
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
this is the situation:

testscript
Code:
#!/usr/bin/ksh

scp user@remotehost:/some/folder/logfile.txt .
mainscript
Code:
#!/bin/bash

ssh user@remotehost 'echo test'
scp /folder/scp_cd.sh user@remotehost:/some/folder/
ssh user@remotehost 'pwd'
ssh user@remotehost './scp_cd.sh'
ssh user@remotehost 'cd /some/folder/; rm -f scp_cd.sh'
ssh user@remotehost 'echo einde'
result
Code:
test
scp_cd.sh                                                                           100%  111     0.1KB/s   00:00
/some/folder
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for remotehost has changed,
and the key for the according IP address ........
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
a9:6d:b4:05:94:15:12:62:cc:ca:5c:7b:a6:ad:53:72.
Please contact your system administrator.
Add correct host key in /some/folder/.ssh/known_hosts to get rid of this message.
Offending key in /some/folder/.ssh/known_hosts:22
RSA host key for remotehost has changed and you have requested strict checking.
Host key verification failed.
einde
why do i get that big warning at the end? is it because of:
Quote:
Offending key in /some/folder/.ssh/known_hosts:22

Last edited by brownie_cookie; 03-28-2011 at 07:45 AM.
 
Old 03-28-2011, 07:50 AM   #69
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

Delete line 22 in /home/youruser/.ssh/known_hosts and try again. Also, you said you've split the script in two to keep it under control (overzichtelijk), but you might loose control if you execute a script on the other side. If it fails and terminates the connection for example because of a command inside it, you'll loose your connection without viewing any error messages. On the other hand if you use everything from your side in one script, you'll know which command is the culprit since you get all output directly to your console. If you want some more clarification, feel free to contact me off line (sending me a PM or mail).

Kind regards,

Eric
 
Old 03-28-2011, 07:56 AM   #70
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
i've just deleted it and now i get only
Code:
Host key verification failed
but still, i can automatically log on to my remote server...
 
Old 03-28-2011, 08:03 AM   #71
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
i've send you an email ;-)
 
Old 03-28-2011, 08:12 AM   #72
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by brownie_cookie View Post
i've send you an email ;-)
Hi,

Received and answered.

Kind regards,

Eric
 
Old 03-29-2011, 08:06 AM   #73
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
for instance,
i've got a script that logs me on to the remote server, then i do some commands (automatically) on the remote side but after those commands i have to execute some commands on the local host, how do i terminate the connection with the remote server so i can do those commands on the local server (automatically) ??
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 12:21 AM
Fedora 10/unable to ssh out from box to remote host (SSH within LAN ok) huskeypm Linux - Networking 3 04-14-2009 07:37 PM
SSH - Remote aplications in remote server Urien Linux - Newbie 11 04-04-2009 04:02 AM
Remote login with SSH, but display on remote computer. brodin Linux - Software 3 09-09-2007 03:01 AM
Remote SSH Kurzweil Linux - Newbie 23 05-14-2005 12:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration