1 Script Not Sending Password - Other Scripts OK


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting 1 Script Not Sending Password - Other Scripts OK
# 1  
Old 03-09-2018
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:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 03-10-2018 at 06:21 AM.. Reason: Added CODE tags.
# 2  
Old 03-09-2018
Give it a try as:

PASSWORD='XXX$XXX'
This User Gave Thanks to Aia For This Post:
# 3  
Old 03-09-2018
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 03:56 AM..
# 4  
Old 03-09-2018
Quote:
Originally Posted by Wrjames2
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

This User Gave Thanks to Aia For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sending password over SSH

Hi guys, I wrote a script that logs into around 30 nodes via SSH as root. The issue is that I have to punch in the root password everytime and it is being a hassle. Is there a way to save the password in a secure way and automate the whole procedure. I do not want to save the password in... (9 Replies)
Discussion started by: Junaid Subhani
9 Replies

2. Shell Programming and Scripting

Expect Script sending password with $ and symbols

All, I am trying to use expect to send SFTP password because I am unable to share a key with the vendor. They gave me a password that uses some symbols in it like $ and ! When i try to use the send command in expect it thinks the $ is a variable. Is there anyway to have it send the... (2 Replies)
Discussion started by: markdjones82
2 Replies

3. Solaris

Pam Module sending a cannot get password enry after certain period in /var/adm/messag

Pam Module sending a cannot get password enry after certain period in /var/adm/message. pam_login_limit(auth): Cannot get Password entry for user 'dbsnmp' What is dbsnmp? Also if account is locked does pam module checks for this locked account at regular interval and keeps on posting... (2 Replies)
Discussion started by: student2009
2 Replies

4. Shell Programming and Scripting

Help with Script using rsh and scripts within scripts

Hi, I've written a script that runs on a Database server. It has to shutdown the Application server, do an Oracle Dump and then restart the Application server. Its been a long time since I wrote any shells scripts. Can you tell me if the scripts that I execute within my script will be executed... (3 Replies)
Discussion started by: brockwile1
3 Replies

5. Shell Programming and Scripting

Idea for DB Password in Shell Scripts

I work in an environment where we have a Oracle DB Server on a AIX box. There are several batch scripts that load and execute on the database. The DBA wants to periodically change the password. Ideally I would like to have one common place to maintain the database as it is changed. I was thinking... (2 Replies)
Discussion started by: mode09
2 Replies

6. Shell Programming and Scripting

how to change root password using shell script with standard password

Hi Friends. I am new to scripting now i want to change the root password using the script with standard password. which is the easy scripting to learn for the beginner, Thanks in advance. (2 Replies)
Discussion started by: kurva
2 Replies

7. Shell Programming and Scripting

Sending ssh password in a script

Is there any way to send password in a sh script, to establish a ssh connection with the remote server, without having shared the public key? The command I'm currently using is in my script is !#/bin/sh ... ssh -l user remotehost "ls -l" I have shared the public key of the local... (3 Replies)
Discussion started by: farahzaiba
3 Replies

8. Shell Programming and Scripting

root password in SH scripts

Hi Everybody! I have to make my script more automatic as possible! In this, a have to mount a usb pen drive into a Blade (Solaris 2.8), and the only away I know to do it, is becoming a SuperUser (root). But unfortunately, when I become a SuperUser inside the script, it doesn't let me to put... (1 Reply)
Discussion started by: roosse77i
1 Replies

9. Windows & DOS: Issues & Discussions

ssh: sending password from windows client

Hi. My workstation is Windows. I use putty to connect to unix servers. The problem is that i'm doing it many times a day and each time i need to supply password. I have no control on ssh configuration on servers, because of account restrictions. So i can't use key authentication, how is suggested... (4 Replies)
Discussion started by: kukuruku
4 Replies

10. Cybersecurity

Sending a message to a user when password will be expired

Hi, Does anyone have a script (for AIX) that sends a message to a user that his password will be expired within 5 days for ex. Thanks (1 Reply)
Discussion started by: Diederd
1 Replies
Login or Register to Ask a Question