LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 04-22-2020, 02:13 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Rep: Reputation: 180Reputation: 180
can batch (-b) sftp be done using a password and not just a private key


Per the subject, can batch (-b) sftp be done using a password and not just a private key?

I have a file-exchange client that wants to switch us from sftp using a private key to using a password. As I understand it, this is not possible.

True, false?
 
Old 04-22-2020, 03:16 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,775

Rep: Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933
I would not know why your client would prefer going back to passwords but your correct that sftp batch mode requires using keys but that is not the only way.

You could use lftp and create a script file. One way the username/password is on the command line so it will be visible to anyone that can look at running processes. You could use an expect file but the password would be embedded in the script.

You can still use sftp via expect but your batch file would be written in the script file itself. If you are unfamiliar with tcl programming that could be a small learning curve.
 
1 members found this post helpful.
Old 04-24-2020, 05:12 AM   #3
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Original Poster
Rep: Reputation: 180Reputation: 180
Thanks for the tips. I don't know why this client is pushing passwords either. I think there are some new people there that don't really know about batch-mode anything and only think people pick up their files manually via a browser. The lftp command does appear to accept a PW on the command line: 'lftp -u user,pass ...'. I could "hide" the PW in a C program and do: 'lftp -u user,`mypw`, and make mypw only executable by the batch user. Not perfect.

I've given a long this of reason to NOT abandom private keys to the client. They have kicked it up a level and will get back to me. I'll post results here, but thanks for answering my original question about sftp.
 
Old 04-24-2020, 05:51 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,343
Blog Entries: 3

Rep: Reputation: 3754Reputation: 3754Reputation: 3754Reputation: 3754Reputation: 3754Reputation: 3754Reputation: 3754Reputation: 3754Reputation: 3754Reputation: 3754Reputation: 3754
As per the manual page for sftp:

Quote:
-b batchfile
Batch mode reads a series of commands from an input batchfile in‐stead of stdin. Since it lacks user interaction it should be used in conjunction with non-interactive authentication to obviate the need to enter a password at connection time (see sshd(8) and ssh-keygen(1) for details). [...]
So regressing to using a password would be incompatible with batch mode.

What is their alleged reason for wanting to regress? Keys are considered a well-established best practice for SSH / SFTP. If it is a matter of using authentication tokens, most can be set up to work with keys, at least the newer models can do that.
 
Old 04-24-2020, 11:30 AM   #5
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,814

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by Turbocapitalist View Post
As per the manual page for sftp:
So regressing to using a password would be incompatible with batch mode.
We cobbled together a batch mode FTP process many years ago as we had to work with third-parties that either didn't know know about sftp or were too lazy to set it up. It involved use of an Expect wrapper script and what we called a manifest file to drive the file transfer process ... and .netrc. It ran in the division's big iron batch scheduler just fine.

Quote:
Keys are considered a well-established best practice for SSH / SFTP.
I hate to say it but in my experience it is the Wintel admins that have the most trouble with file transfers. The vast, vast majority of those third-parties who were having us use ftp were having us send file to/from one of their Wintel servers. That was always something that puzzled me as they (the local Wintel guys, at least) were maniacs about key management for other areas of the environment.
 
Old 05-27-2020, 01:42 PM   #6
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Original Poster
Rep: Reputation: 180Reputation: 180
Well, the admins involved said they would check into it but have not gotten back to me. I think they must have realized they knew not what they were talking about. Since their "deadline" for making this change has passed, I'm going to assume that I don't have to do anything stupid. I'll close this issue. If I hear from them again, I'll be back! Thanks for all the useful feedback.
 
  


Reply

Tags
security, sftp



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
LXer: Passwordless SSH login using public key and private key LXer Syndicated Linux News 0 02-23-2020 06:42 PM
How do I convert a putty private key to be used as a private key on a RedHat or Ubuntu Server greavette Linux - General 2 06-26-2019 08:40 PM
sftp using batch and public key doing 'put' launching from crontab skagnola Linux - Newbie 13 05-18-2017 06:02 PM
[SOLVED] SFTP fails public key authentication in batch mode chicagovol Linux - Newbie 1 05-26-2011 03:52 PM
SFTP without password and without public/ private key iamakshay Programming 2 10-19-2009 04:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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