Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8458833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:11:08+00:00 2026-06-10T13:11:08+00:00

I have a bash script that I use on a supercomputer (CentOS). This computer

  • 0

I have a bash script that I use on a supercomputer (CentOS). This computer is setup such that there is a single node that has internet access (call it “connectedNode“)– and through this node, all the other nodes (call them “workNodes“) can be accessed. Most of the work is done after ssh-ing through the connectedNode to a workNode.

I have a bash script which is essentially this one liner:

#!/bin/bash
# scpdropbox
scp $1 myusername@desktop:/Users/myusername/Dropbox/Inbox

that allows me to run a command like:

scpdropbox file.name

and because I’ve setup ssh-keys between all of the nodes and my external computer (desktop) I want this file to end up on, it works great. Of course, this only works if I’m running it from the connectedNode, otherwise, this command fails, as the workNodes aren’t connected to the internet.

How do I modify this script so that I could run this command from a workNode, and have it send the correct files and whatnot through the connectedNode and on to the desktop?

Things I’ve tried so far (commented out):

PWD=$(pwd)

# ssh myusername@connectedNode <<'ENDSSH'
# ssh -t myusername@connectedNode <<'ENDSSH'
ssh -t -t myusername@connectedNode <<'ENDSSH'
#commands to run on remote host
# scp \$PWD/\$1 myusername@desktop:/Users/myusername/Dropbox/Inbox
# scp '$PWD'/'$1' myusername@desktop:/Users/myusername/Dropbox/Inbox
scp $PWD/$1 myusername@desktop:/Users/myusername/Dropbox/Inbox
ENDSSH

And they don’t work. I get errors like:

Pseudo-terminal will not be allocated because stdin is not a terminal.
/home/dir/myusername: not a regular file
tcgetattr: Inappropriate ioctl for device

depending on which of the things I’ve tried.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:11:09+00:00Added an answer on June 10, 2026 at 1:11 pm

    On each of your worknodes, add something like the following to your ~/.ssh/config file:

    host desktop
       ProxyCommand ssh -xaqW%h:22 myusername@connectedNode
    

    Now, when a worknode tries to ssh to desktop, it will first connect to myusername@connectedNode, then continue the SSH to desktop (%h) port 22.

    I use this to allow my workstation at work, with no Internet or default route, to connect to external hosts through another machine on the network that does have network access on another network interface. Works like a charm.

    Note that if you’re using a very old ssh that doesn’t support the -W option, you can also use this:

    host desktop
       ProxyCommand ssh -x -a -q myusername@connectedNode nc %h 22
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bash script that has this function in it: function start_vi() {
I have a bash script that has set -x in it. Is it possible
I have a bash script that looks like this: #!/bin/sh previousRelease=`git describe --tags --match
I have a bash script that I mostly use in interactive mode. However, sometimes
i have this problem: I have created a bash script that performs some tasks.
I have bash script that I use regularly in my job to automate a
I use a bash script that dumps separate areas of a single database to
I have this bash script on the server that runs every hour, via cron.
I'm have a bash script that I use to manipulate files on a computation
I have a bash shell script. I have a psql copy command that has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.