Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
[SOLVED] TFTP in Debian 8.0
[SOLVED] TFTP in Debian 8.0
Hello,
I'm a beginner to Debian Linux and I have a question regarding TFTP.
I'm trying to run it in script.
#!/bin/bash
FILE="/home/eclipse/test.txt"
tftp 192.168.0.50 << '!'
put ${FILE} /remote/directory
quit
!
exit 0
When I run it:
tftp: ${FILE}: No such file or directory
I've done many researches, but couldn't solve it.
Please help!
I'm a beginner to Debian Linux and I have a question regarding TFTP.
I'm trying to run it in script.
#!/bin/bash
FILE="/home/eclipse/test.txt"
tftp 192.168.0.50 << '!'
put ${FILE} /remote/directory
quit
!
exit 0
When I run it:
tftp: ${FILE}: No such file or directory
I've done many researches, but couldn't solve it.
Please help!
Last edited by tigger on 2017-09-01 20:01, edited 2 times in total.
Re: TFTP in Debian 8.0
Looks like the path to the file is not correct, where is the file?When I run it:
tftp: ${FILE}: No such file or directory
${FILE} = what exact path?
Re: TFTP in Debian 8.0
Hello TonyT,
It's located in /home/eclipse/
It works when I manually typed in.
tftp 192.168.0.50 << '!'
put /home/eclipse/test.txt /home/eclipse/test.txt /remote/directory/
quit
!
Terminal respond:
Sent 5627 bytes in 0.0 seconds
Sent 5627 bytes in 0.0 seconds
It's located in /home/eclipse/
It works when I manually typed in.
tftp 192.168.0.50 << '!'
put /home/eclipse/test.txt /home/eclipse/test.txt /remote/directory/
quit
!
Terminal respond:
Sent 5627 bytes in 0.0 seconds
Sent 5627 bytes in 0.0 seconds
Re: TFTP in Debian 8.0
Disclaimer: I'm horrible at bash scripting... That said, I think it should look like this....
Code: Select all
#!/bin/bash
export FILE=/home/eclipse/test.txt
tftp 192.168.0.50 << '!'
put $FILE /remote/directory
quit
!
exit 0
Re: TFTP in Debian 8.0
Hello Bryanmc,
I've done that but same result...
tftp: $FILE: No such file or directory
I've tried others:
With the quote -> export FILE="/home/eclipse/test.txt" or, FILE="/home/eclipse/test.txt"
Without the quote -> export FILE=/home/eclipse/test.txt or, FILE=/home/eclipse/test.txt
With braces {}, parentheses (), quotation "" around FILE
However, no uses..
I've done that but same result...
tftp: $FILE: No such file or directory
I've tried others:
With the quote -> export FILE="/home/eclipse/test.txt" or, FILE="/home/eclipse/test.txt"
Without the quote -> export FILE=/home/eclipse/test.txt or, FILE=/home/eclipse/test.txt
With braces {}, parentheses (), quotation "" around FILE
However, no uses..
Re: TFTP in Debian 8.0
But did you export the variable for FILE?tigger wrote:Hello Bryanmc,
I've done that but same result...
tftp: $FILE: No such file or directory
export FILE=/home/eclipse/test.txt
Re: TFTP in Debian 8.0
Yes, it's writable.Is "/remote/directory" world writable?
Yes, I've done that.But did you export the variable for FILE?
export FILE=/home/eclipse/test.txt
Re: TFTP in Debian 8.0
wizard10000, thanks for your advice.wizard10000 wrote:Try this -
Part of the problem you appear to have is that some versions of FTP (and TFTP) don't invoke a shell so you can't pass shell variables to them.Code: Select all
#!/bin/bash FILE = "/home/eclipse/test.txt" tftp 192.168.0.50 -c put ${FILE} /remote/directory exit 0
Good luck -
I'm currently using tftp-hpa 5.2, with remap, with tcpwrappers.
I got following respond now:
usage: tftp host-name [port]
tftp>
I had to enter "quit" to exit from there.
Re: TFTP in Debian 8.0
Okay, thanks for letting me know..wizard10000 wrote:Check the man page for your tftp client and see if it supports the -c switch. It's possible you're not able to pass shell variables to your tftp client - if that's the case you may not be able to get there from here
edit: I just installed Debian's tftp client and read its man page - it doesn't support -c as a command line argument. Since a tftp session isn't a shell you can't pass shell environment variables to it; you have to assign them client-side and Debian's tftp client doesn't support that.
Wish I had better news -
BR
Re: TFTP in Debian 8.0
https://stackoverflow.com/questions/493 ... sh-heredoctigger wrote:Hello,
I'm a beginner to Debian Linux and I have a question regarding TFTP.
I'm trying to run it in script.
#!/bin/bash
FILE="/home/eclipse/test.txt"
tftp 192.168.0.50 << '!'
put ${FILE} /remote/directory
quit
!
exit 0
When I run it:
tftp: ${FILE}: No such file or directory
I've done many researches, but couldn't solve it.
Please help!
Don't use '!' as delimiter.
Instead, do like:
Code: Select all
tftp 192.168.0.50 <<EOF
put ${FILE} /remote/directory
quit
EOF
Re: [SOLVED] TFTP in Debian 8.0
It works! Thank you!!reinob wrote:https://stackoverflow.com/questions/493 ... sh-heredoc
Don't use '!' as delimiter.
Instead, do like:Code: Select all
tftp 192.168.0.50 <<EOF put ${FILE} /remote/directory quit EOF