LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-17-2016, 09:18 AM   #1
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Rep: Reputation: Disabled
SFTP not wokring


Yesterday I ran several times the sftp command with no problems. I created a bash script to run the sftp command automagically and it ran with no errors, but the results was not what I was expecting. Well now today I take my computer out of hibernation and run the script, giving the sftp command doesn't work??????? I ran the same line of code in the command line with no problems. Copied and pasted it from the command line to my script. Ran it. Doesn't run. I take the simple line out, runs fine. WEIRD!!!

This is the line:

sftp username@hostname

Now it only works when I type it in and press enter.

Any help is HIGHLY appreciated!!!!
 
Old 11-17-2016, 09:29 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,522

Rep: Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224
What are the error messages if any?

You can add set -xv to the script (below #!/..) to enable debugging.
 
Old 11-17-2016, 09:42 AM   #3
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Running the script from Oracle EDQ, on error is when I run it from EDQ BUT if I comment out the line, the script works fine. Weird. Ill use your advice and see what comes up. Thank you for your help!!!!
 
Old 11-17-2016, 09:45 AM   #4
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Just ran it, in EDQ it gave an error but how can I see this error in the command line?
 
Old 11-17-2016, 09:48 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,522

Rep: Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224
Not familiar with EDQ. What happens when you run it from the terminal window?
 
Old 11-17-2016, 10:12 AM   #6
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
From terminal it works fine, but when I run it from within EDQ, it doesn't work. Strange cause it was all working fine yesterday. If I comment out this line, it works fine:

sftp username@hostname

Can even access it from WinSCP just fine
 
Old 11-17-2016, 10:25 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,426

Rep: Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786
You need to find a way to get 'EDQ' to o/p both stdout and stderr to the screen and/or a file, so we can debug it.
 
Old 11-18-2016, 07:40 AM   #8
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
I should put things his way instead of including EDQ......I can execute sftp commands in the command line but not in a BASH script. I haven't the slightest idea what is going on because the previous day it was working just fine.
 
Old 11-20-2016, 11:12 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,426

Rep: Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786
Show us your code, both inside and outside a shell script. Also, as above, try with 'set -vx' so we can get more info.
 
Old 11-21-2016, 02:39 PM   #10
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
I have actually installed the package expect and my issue has been resolved. Not the best because it it unsecure, but it's a short term solution. Here is the code:

expect -c "
spawn sftp username@hostname
expect "assword"
send "password is here\r"
expect "sftp>"
send "cd /folder to place file\r"
expect "sftp>"
send "put *.DAT\r"
expect "sftp>"
send "exit\r"
interact "

You might not need all of the lines but I needed to do certain things. Hope this helps!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Please help. yum not wokring ahsanpmd Linux - Enterprise 17 12-24-2013 05:05 PM
[SOLVED] internet is not wokring deep27ak Solaris / OpenSolaris 9 01-23-2012 08:53 AM
qmailrocks smtp auth not wokring posixjunkie Linux - Networking 6 05-08-2004 11:29 AM
Nothing's wokring in Gentoo 1.4rc4! Help! kierl Linux - General 2 07-28-2003 04:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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