👤


Shell Programming and Scripting

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

1 Script Not Sending Password - Other Scripts OK

ftp, script argument parameter

👤 Login to reply
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-09-2018
Wrjames2 Wrjames2 is offline
Registered User
 
Join Date: Mar 2018
Last Activity: 9 March 2018, 10:52 PM EST
Location: Durham, NC
Posts: 2
Thanks: 2
Thanked 0 Times in 0 Posts
1 Script Not Sending Password - Other Scripts OK

I am building FTP Script on my Bluehost VPS Server. I have several and all work great except this one.... I think there are two issues .. One with the command and One with "$" in the password.

Code:
#!/bin/sh
HOST=invtransfer@52.44.151.220
USER=invtransfer
PASSWORD=XXX$XXX  - $ is real in password.... 
sftp $HOST <<EOF
user $PASSWORD
get INVENTORY.txt
exit
EOF

This is one of the MANY different things I have tried... It connects and asks for the password - if I type it in then it gets the file..
Cannot get it to correctly deliver the password..
Any help would be appreciated... I know is must be something small.


Moderator's Comments:
1 Script Not Sending Password - Other Scripts OK Please use CODE tags as required by forum rules!

Last edited by RudiC; 03-10-2018 at 05:21 AM.. Reason: Added CODE tags.
Sponsored Links
    #2  
Old 03-09-2018
Aia's Unix or Linux Image
Aia Aia is offline
Registered User
 
Join Date: May 2008
Last Activity: 30 June 2018, 11:27 AM EDT
Posts: 1,715
Thanks: 49
Thanked 663 Times in 619 Posts
Give it a try as:

PASSWORD='XXX$XXX'
The Following User Says Thank You to Aia For This Useful Post:
Wrjames2 (03-09-2018)
Sponsored Links
    #3  
Old 03-09-2018
Wrjames2 Wrjames2 is offline
Registered User
 
Join Date: Mar 2018
Last Activity: 9 March 2018, 10:52 PM EST
Location: Durham, NC
Posts: 2
Thanks: 2
Thanked 0 Times in 0 Posts
I still have to type in the password...

This script .....

Code:
HOST=invtransfer@52.44.151.220
USER=invtransfer
PASSWORD='XXX$XXX'
sftp $HOST <<EOF
send $PASSWORD
get INVENTORY.txt
quit
EOF

Does this.. It is sending the correct password format but I still have to type it in.

"Send" doesn't work "user" doesn't work...

Code:
[hxisssmy@server ~]$ sh Bell_Daily.sh
Connecting to 52.44.151.220...
invtransfer@52.44.151.220's password:
sftp> send XXX$XXX
Invalid command.
sftp> get INVENTORY.txt
Fetching /INVENTORY.txt to INVENTORY.txt
/INVENTORY.txt                                100%  408KB 408.2KB/s   00:00
sftp> quit


Last edited by Scrutinizer; 03-10-2018 at 02:56 AM..
    #4  
Old 03-09-2018
Aia's Unix or Linux Image
Aia Aia is offline
Registered User
 
Join Date: May 2008
Last Activity: 30 June 2018, 11:27 AM EDT
Posts: 1,715
Thanks: 49
Thanked 663 Times in 619 Posts
Quote:
Originally Posted by Wrjames2 View Post
I still have to type in the password...

This script .....

HOST=invtransfer@52.44.151.220
USER=invtransfer
PASSWORD='XXX$XXX'
sftp $HOST <<EOF
send $PASSWORD
get INVENTORY.txt
quit
EOF

Does this.. It is sending the correct password format but I still have to type it in.

"Send" doesn't work "user" doesn't work...

[hxisssmy@server ~]$ sh Bell_Daily.sh
Connecting to 52.44.151.220...
invtransfer@52.44.151.220's password:
sftp> send XXX$XXX
Invalid command.
sftp> get INVENTORY.txt
Fetching /INVENTORY.txt to INVENTORY.txt
/INVENTORY.txt 100% 408KB 408.2KB/s 00:00
sftp> quit
I did not catch that before but you are not using FTP like you said initially. You are using SFTP. It doesn't work like that. It will not read a password from a stream. Either you set it up with a ssh key pair or you have to enter the password interactively.
Code:
sftp username@remote_hostname_or_IP

The Following User Says Thank You to Aia For This Useful Post:
Wrjames2 (03-09-2018)
Sponsored Links
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sending password over SSH Junaid Subhani Shell Programming and Scripting 9 11-12-2014 10:18 AM
Expect Script sending password with $ and symbols markdjones82 Shell Programming and Scripting 2 12-15-2010 11:47 AM
Sending ssh password in a script farahzaiba Shell Programming and Scripting 3 01-30-2009 07:31 PM
ssh: sending password from windows client kukuruku Windows & DOS: Issues & Discussions 4 10-31-2008 01:40 PM
Sending a message to a user when password will be expired Diederd Security 1 01-28-2002 05:00 PM



All times are GMT -4. The time now is 10:39 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?