Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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...
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?
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.
...
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/").
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.