Page 1 of 1
SSH SFTP with UserName/Password Authentication
Posted: Sun Mar 30, 2025 12:27 pm
by Pmaric
We have 2 trading partners who want us to start using SFTP over Port 22 with user/password authentication. Both have said keys should not be needed. Before attempting to create a script, I am trying first to connect interactively. On both partner's connections, I connect, it asks for password, then I get the following error:
tcgetattr: Invalid argument
I am reading something about terminals, which is not clear to me. Any help would be most appreciated.
Re: SSH SFTP with UserName/Password Authentication
Posted: Sun Mar 30, 2025 12:39 pm
by Pmaric
Also, I have set up connections using public/private keys successfully in the past, so I am familiar with the basics.
Re: SSH SFTP with UserName/Password Authentication
Posted: Mon Mar 31, 2025 1:32 pm
by Pmaric
Over 1000 views and no responses?

OK, I'll research more and post my solution here.
Re: SSH SFTP with UserName/Password Authentication
Posted: Mon Mar 31, 2025 1:51 pm
by gmalchow
You don't happen to have a dash in your password do you?
When you are connecting, are you using something like putty, or winscp? Is it possible that however you are connecting isn't a true tty?
Can the admin of the server offer any help?
Re: SSH SFTP with UserName/Password Authentication
Posted: Mon Mar 31, 2025 8:30 pm
by Pmaric
Thanks!
There is no dash in the password. It may very well be possible I am connecting to something that isn't a true tty. I guess I need to find out what a true tty is.
I am using the AS400 to connect, from a command line -- STRQSH, then manually entering the FTP script.
ssh
user@partner.ip
It connects, asks for password, then I get that message - "tcgetattr: Invalid argument"
The admin of the server has gone silent. Maybe I'll email again.
Re: SSH SFTP with UserName/Password Authentication
Posted: Mon Mar 31, 2025 9:36 pm
by gmalchow
I believe that 5250 terminal sessions started from STRQSH or CALL QP2TERM are not true tty devices. Can you try using something like putty to verify you can connect and authenticate to the sshd (server)?
Assuming the SFTP client is running on an IBM i, and you are required to authenticate with a password to the sshd, you will need to use a tool like Expect.
Scott published a document titled "Scripting the OpenSSH, SFTP, and SCP Utilities in i". That document was instrumental in me understanding how to use SFTP where I had to authenticate with a password.
Re: SSH SFTP with UserName/Password Authentication
Posted: Mon Mar 31, 2025 10:03 pm
by Pmaric
I just read our illustrious leader's (SK) write-up on SFTP. Since I am using a 5250 terminal, perhaps it can't be done with password authentication. I will try to get them to use the keys authentication.
Re: SSH SFTP with UserName/Password Authentication
Posted: Tue Apr 01, 2025 6:05 pm
by Pmaric
OK, I sent them a key, and all is good. II just had to change the command from ssh user@IP to sftp user@IP.