upload to sftp batch modeUpload file to ftp server using commands in shell script?Can't show the content of...
A continuous water "planet" ring around a star
Can I enter the USA with an E-2 visa and a one way flight ticket?
Simplification of numbers
How would timezones work on a planet 100 times the size of our Earth
Does the rule that you cannot willingly end your move in another creature's space force or prevent certain actions?
What is a good class if we remove subclasses?
Word for an event that will likely never happen again
How do some PhD students get 10+ papers? Is that what I need for landing good faculty position?
Do beef farmed pastures net remove carbon emissions?
How to display numbers like 10,000.42 using siunitx?
Why is there a large performance impact when looping over an array over 240 elements?
Authors on the Credibility and Corruption of Modern Science
If clocks themselves are based on light signals, wouldn't we expect the measured speed of light to always be the same constant?
How far did Gandalf and the Balrog drop from the bridge in Moria?
How many people would you need to pull a whale over cobblestone streets?
PhD advisor lost funding, need advice
How to take the beginning and end parts of a list with simpler syntax?
Took GRE two times, same scores with minor differences - worth sending both?
Is there a way to count the number of lines of text in a file including non-delimited ones?
Are those flyers about apartment purchase a scam?
Is this n-speak?
How many British prisoners of war were taken by the Wehrmacht and how many died?
Why aren't rockets built with truss structures inside their fuel & oxidizer tanks to increase structural strength?
Can you end your own spell prematurely?
upload to sftp batch mode
Upload file to ftp server using commands in shell script?Can't show the content of /sdcard of my Android phone from sftp in Ubuntu's Nautilus or FileZillascp can't upload/download files even though ssh worksProper permissions on SFTP upload and download subdirectories in a user's home directory?Can lftp read netrc for sftp-connectionsSet startup folder for SFTP to be other than /home/username is throwing me permission issuesDisallow to download a file via SFTPBusy production SFTP server configurationIs SFTP/FTP file upload size configurable in Linux?Chrooted upload-only SFTP account - what requests to blacklist/whitelist?Ubuntu SFTP upload permission
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I need to upload files to an SFTP server as part of an automated pipeline process (so can not be interactive). I do not have ssh access so I can not use scp or rsync.
I have had some success using the solution proposed in this answer:
sftp user@server <<EOF
put localPath remotePath
EOF
However I am looking for something a bit more solid, as I will have no indication if this fails. For example, if I wanted to download from an SFTP server I can use the following syntax:
sftp user@server:remotePath localPath
Is there an equivalent one-liner for uploading?
sftp
add a comment |
I need to upload files to an SFTP server as part of an automated pipeline process (so can not be interactive). I do not have ssh access so I can not use scp or rsync.
I have had some success using the solution proposed in this answer:
sftp user@server <<EOF
put localPath remotePath
EOF
However I am looking for something a bit more solid, as I will have no indication if this fails. For example, if I wanted to download from an SFTP server I can use the following syntax:
sftp user@server:remotePath localPath
Is there an equivalent one-liner for uploading?
sftp
add a comment |
I need to upload files to an SFTP server as part of an automated pipeline process (so can not be interactive). I do not have ssh access so I can not use scp or rsync.
I have had some success using the solution proposed in this answer:
sftp user@server <<EOF
put localPath remotePath
EOF
However I am looking for something a bit more solid, as I will have no indication if this fails. For example, if I wanted to download from an SFTP server I can use the following syntax:
sftp user@server:remotePath localPath
Is there an equivalent one-liner for uploading?
sftp
I need to upload files to an SFTP server as part of an automated pipeline process (so can not be interactive). I do not have ssh access so I can not use scp or rsync.
I have had some success using the solution proposed in this answer:
sftp user@server <<EOF
put localPath remotePath
EOF
However I am looking for something a bit more solid, as I will have no indication if this fails. For example, if I wanted to download from an SFTP server I can use the following syntax:
sftp user@server:remotePath localPath
Is there an equivalent one-liner for uploading?
sftp
sftp
asked May 2 '18 at 8:38
Inbar RoseInbar Rose
1531 silver badge7 bronze badges
1531 silver badge7 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You can use "Batch Mode" of sftp.
From manual:
> -b batchfile
> Batch mode reads a series of commands from an input batchfile instead of stdin. Since it lacks user interaction it
> should be used in conjunction with non-interactive authentication. A batchfile of ‘-’ may be used to indicate
> standard input. sftp will abort if any of the following commands fail: get, put, reget, reput, rename, ln, rm,
> mkdir, chdir, ls, lchdir, chmod, chown, chgrp, lpwd, df, symlink, and lmkdir. Termination on error can be sup‐
> pressed on a command by command basis by prefixing the command with a ‘-’ character (for example, -rm /tmp/blah*).
Which means, you create a temporary file with the commands and execute the commands in the file with "sftp -b tempfile user@server"
There are other tools around for such things, e.g. lftp
add a comment |
The answer by Marco led me to create a simple script to wrap the process, but essentially what I am doing in the script is the following:
- creating a batchfile with
put {local} {remote}commands for the file(s) to upload. - running the following command:
sftp -b {batch_file} -i {identity_file} -o StrictHostKeyChecking=no {username}@{hostname}
This command will work without needing any input from the user, and will have an error code that can be checked for success or failure.
I just wanted to include this answer here in a more complete form for future visitors.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441254%2fupload-to-sftp-batch-mode%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use "Batch Mode" of sftp.
From manual:
> -b batchfile
> Batch mode reads a series of commands from an input batchfile instead of stdin. Since it lacks user interaction it
> should be used in conjunction with non-interactive authentication. A batchfile of ‘-’ may be used to indicate
> standard input. sftp will abort if any of the following commands fail: get, put, reget, reput, rename, ln, rm,
> mkdir, chdir, ls, lchdir, chmod, chown, chgrp, lpwd, df, symlink, and lmkdir. Termination on error can be sup‐
> pressed on a command by command basis by prefixing the command with a ‘-’ character (for example, -rm /tmp/blah*).
Which means, you create a temporary file with the commands and execute the commands in the file with "sftp -b tempfile user@server"
There are other tools around for such things, e.g. lftp
add a comment |
You can use "Batch Mode" of sftp.
From manual:
> -b batchfile
> Batch mode reads a series of commands from an input batchfile instead of stdin. Since it lacks user interaction it
> should be used in conjunction with non-interactive authentication. A batchfile of ‘-’ may be used to indicate
> standard input. sftp will abort if any of the following commands fail: get, put, reget, reput, rename, ln, rm,
> mkdir, chdir, ls, lchdir, chmod, chown, chgrp, lpwd, df, symlink, and lmkdir. Termination on error can be sup‐
> pressed on a command by command basis by prefixing the command with a ‘-’ character (for example, -rm /tmp/blah*).
Which means, you create a temporary file with the commands and execute the commands in the file with "sftp -b tempfile user@server"
There are other tools around for such things, e.g. lftp
add a comment |
You can use "Batch Mode" of sftp.
From manual:
> -b batchfile
> Batch mode reads a series of commands from an input batchfile instead of stdin. Since it lacks user interaction it
> should be used in conjunction with non-interactive authentication. A batchfile of ‘-’ may be used to indicate
> standard input. sftp will abort if any of the following commands fail: get, put, reget, reput, rename, ln, rm,
> mkdir, chdir, ls, lchdir, chmod, chown, chgrp, lpwd, df, symlink, and lmkdir. Termination on error can be sup‐
> pressed on a command by command basis by prefixing the command with a ‘-’ character (for example, -rm /tmp/blah*).
Which means, you create a temporary file with the commands and execute the commands in the file with "sftp -b tempfile user@server"
There are other tools around for such things, e.g. lftp
You can use "Batch Mode" of sftp.
From manual:
> -b batchfile
> Batch mode reads a series of commands from an input batchfile instead of stdin. Since it lacks user interaction it
> should be used in conjunction with non-interactive authentication. A batchfile of ‘-’ may be used to indicate
> standard input. sftp will abort if any of the following commands fail: get, put, reget, reput, rename, ln, rm,
> mkdir, chdir, ls, lchdir, chmod, chown, chgrp, lpwd, df, symlink, and lmkdir. Termination on error can be sup‐
> pressed on a command by command basis by prefixing the command with a ‘-’ character (for example, -rm /tmp/blah*).
Which means, you create a temporary file with the commands and execute the commands in the file with "sftp -b tempfile user@server"
There are other tools around for such things, e.g. lftp
answered May 2 '18 at 9:29
MarcoMarco
761 bronze badge
761 bronze badge
add a comment |
add a comment |
The answer by Marco led me to create a simple script to wrap the process, but essentially what I am doing in the script is the following:
- creating a batchfile with
put {local} {remote}commands for the file(s) to upload. - running the following command:
sftp -b {batch_file} -i {identity_file} -o StrictHostKeyChecking=no {username}@{hostname}
This command will work without needing any input from the user, and will have an error code that can be checked for success or failure.
I just wanted to include this answer here in a more complete form for future visitors.
add a comment |
The answer by Marco led me to create a simple script to wrap the process, but essentially what I am doing in the script is the following:
- creating a batchfile with
put {local} {remote}commands for the file(s) to upload. - running the following command:
sftp -b {batch_file} -i {identity_file} -o StrictHostKeyChecking=no {username}@{hostname}
This command will work without needing any input from the user, and will have an error code that can be checked for success or failure.
I just wanted to include this answer here in a more complete form for future visitors.
add a comment |
The answer by Marco led me to create a simple script to wrap the process, but essentially what I am doing in the script is the following:
- creating a batchfile with
put {local} {remote}commands for the file(s) to upload. - running the following command:
sftp -b {batch_file} -i {identity_file} -o StrictHostKeyChecking=no {username}@{hostname}
This command will work without needing any input from the user, and will have an error code that can be checked for success or failure.
I just wanted to include this answer here in a more complete form for future visitors.
The answer by Marco led me to create a simple script to wrap the process, but essentially what I am doing in the script is the following:
- creating a batchfile with
put {local} {remote}commands for the file(s) to upload. - running the following command:
sftp -b {batch_file} -i {identity_file} -o StrictHostKeyChecking=no {username}@{hostname}
This command will work without needing any input from the user, and will have an error code that can be checked for success or failure.
I just wanted to include this answer here in a more complete form for future visitors.
answered 13 hours ago
Inbar RoseInbar Rose
1531 silver badge7 bronze badges
1531 silver badge7 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441254%2fupload-to-sftp-batch-mode%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown