LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-10-2006, 04:49 AM   #1
Nivram
LQ Newbie
 
Registered: Apr 2006
Distribution: Debian
Posts: 9

Rep: Reputation: 0
cp over ssh


Hi,

just a short question: During an ssh session, i'd like to cp a file back to the host i opend the connection from. (How) is this possible ?

Sure, i could use scp, but that would mean, to open another connection and than i'd have to provide the password once more. (I'd like to use it in a script.) I mean, the connection already *is* there...
 
Old 07-10-2006, 05:13 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
How about having ssh-agent handle auth?
 
Old 07-10-2006, 05:19 AM   #3
~=gr3p=~
Member
 
Registered: Feb 2005
Location: ~h3av3n~
Distribution: RHEL 4, Fedora Core 3,6,7 Centos 5, Ubuntu 7.04
Posts: 227

Rep: Reputation: 30
or how about using SFTP

http://www.cae.wisc.edu/site/public/?title=linux-sftp
 
Old 07-10-2006, 05:57 AM   #4
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
or scp (secure copy)

this uses the same authentication as ssh so is as secure:

http://www-hep2.fzu.cz/computing/adm/scp.html

EDIT: sorry - should have read the OP - i feel silly now...

Last edited by pwc101; 07-10-2006 at 07:01 AM.
 
Old 07-10-2006, 06:11 AM   #5
Nivram
LQ Newbie
 
Registered: Apr 2006
Distribution: Debian
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn
How about having ssh-agent handle auth?
Can i tell ssh-agent to "forget" the key again?

I didn't setup passwordless connections because of security reasons. So i would let ssh-agent store the password only during the execution of the script. Is this possible?
 
Old 07-10-2006, 07:19 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Can i tell ssh-agent to "forget" the key again?
Sure. The manual says so ;-p


I didn't setup passwordless connections because of security reasons.
Good, good. There are a few ways to restrict access to use passwordless ssh like limiting by command and IP (range) but I'd only use that on LAN's where you only use hardened secure hosts.


So i would let ssh-agent store the password only during the execution of the script. Is this possible?
You could yes, but it's not something for unattended runs.
If you can explain in detail what you're trying to do maybe we could be a wee bit more helpful.
 
Old 07-11-2006, 02:03 AM   #7
Nivram
LQ Newbie
 
Registered: Apr 2006
Distribution: Debian
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn
...
You could yes, but it's not something for unattended runs.
If you can explain in detail what you're trying to do maybe we could be a wee bit more helpful.
ok, you're right.
I wanted to write a script, that i could call from anywhere by
$ ssh user@host.com "$HOME/bin/myscript"

That script should do some things on the (remote) host i called it from, amongst other things copy files to this host. So i thought about to call it with
$ ssh user@host.com "$HOME/bin/myscript $USER"
so i could use $USER (=$1) and $HOST_IP (extracted from $SSH_CONNECTION or $SSH_CLIENT) in "scp files $USER@$HOST_IP:$HOME/"

As mentioned above, the problem is that the script asks for my password, which should be not necessary if i could use the connection that is already opened (like "cp files $USER@$HOST_IP:$HOME/").

Any ideas?

Last edited by Nivram; 07-11-2006 at 05:16 PM.
 
Old 07-11-2006, 05:45 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Any ideas?
Nothing new, no. Better use ssh-agent.
 
  


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
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
Mac OS X ssh client / linux sshd : ssh hangs/disconnects Apollo77 Linux - Networking 1 05-24-2006 11:53 AM
ssh -> perl -> spawn background proces hangs ssh session rhoekstra Programming 2 04-25-2006 01:05 AM
Passwordless SSH with SSH commercial server and open ssh cereal83 Linux - General 7 04-18-2006 12:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:43 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