LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-07-2020, 07:30 AM   #1
nikolaymartin
LQ Newbie
 
Registered: May 2019
Posts: 9

Rep: Reputation: Disabled
Run Local Script On Remote System via SSH


I have a script in my system. I want to run this script on the remote system which has SSH connection.
 
Old 05-07-2020, 07:32 AM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
İsmail, this is not funny anymore.
 
Old 05-07-2020, 07:38 AM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Use scp, sftp or rsync to copy the script to the remote system. Then use ssh to run it.

Be aware that scp is deprecated due to a security gap that can't be closed.
 
Old 05-07-2020, 07:43 AM   #4
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by berndbausch View Post
Be aware that scp is deprecated due to a security gap that can't be closed.
Note that rsync (and such) use scp too!
sftp is a wholy different sub-system, although it can be internal to ssh nowadays.
 
Old 05-07-2020, 08:39 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,740

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
It depends on how your script is written and how you are using arguments/variables if any. The simplest way to run a script via ssh is:

ssh -T user@remote_server < my_script

rsync uses ssh but not scp.
 
  


Reply

Tags
linux, shell, software



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
Pipe output of local script, ran on remote machine, to local python script trendal Programming 17 07-04-2016 01:56 AM
Work on a remote project with Eclipse via SSH and SVN+SSH (2 remote Linux) alwaystudent Linux - Software 5 08-12-2015 11:40 AM
[SOLVED] SSH remote command: Pipe remote output to local machine? kenneho Linux - Server 6 12-06-2012 01:37 AM
ssh - using variables in call to start remote script from local script babag Linux - Networking 2 06-03-2008 04:50 PM
clamd upgradation in remote mach through local mac by script to be run on local mach Narayandutt Programming 3 11-29-2006 10:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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