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

  • Home
  • SEARCH
  • 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 6347257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:10:44+00:00 2026-05-24T21:10:44+00:00

I am trying to write a shell script that creates some directories on a

  • 0

I am trying to write a shell script that creates some directories on a remote server and then uses scp to copy files from my local machine onto the remote. Here’s what I have so far:

ssh -t user@server<<EOT
DEP_ROOT='/home/matthewr/releases'
datestamp=$(date +%Y%m%d%H%M%S)
REL_DIR=$DEP_ROOT"/"$datestamp
if [ ! -d "$DEP_ROOT" ]; then
    echo "creating the root directory"
    mkdir $DEP_ROOT
fi
mkdir $REL_DIR
exit
EOT

scp ./dir1 user@server:$REL_DIR
scp ./dir2 user@server:$REL_DIR

Whenever I run it I get this message:

Pseudo-terminal will not be allocated because stdin is not a terminal.

And the script just hangs forever.

My public key is trusted on the server and I can run all the commands outside of the script just fine. Any ideas?

  • 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-05-24T21:10:45+00:00Added an answer on May 24, 2026 at 9:10 pm

    Try ssh -t -t(or ssh -tt for short) to force pseudo-tty allocation even if stdin isn’t a terminal.

    See also: Terminating SSH session executed by bash script

    From ssh manpage:

    -T      Disable pseudo-tty allocation.
    
    -t      Force pseudo-tty allocation.  This can be used to execute arbitrary 
            screen-based programs on a remote machine, which can be very useful,
            e.g. when implementing menu services.  Multiple -t options force tty
            allocation, even if ssh has no local tty.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a shell script that, when run, will set some environment
I'm trying to write a shell script that will make several targets into several
I am trying to write a wrapper shell script that caches information every time
I am trying to write a simple shell-script that prints out the first parameter
I'm trying to write a shell script that does a search and replace inside
I'm currently trying to write a .cmd Windows Shell script that would iterate over
I am trying to write a bash shell script that consumes a high amount
I'm trying to write a powershell script that creates an Exchange Mailbox. This works
Background: I'm trying to write a shell script using php that will automatically checkout
I am trying to write a shell script to delete all the sub directories

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.