technote:sftp
This is an old revision of the document!
Transferring files via SFTP
Linux
The Linux sftp
command does not provide an argument to specify a password. If you do not want to configure keys for the transfer, you can install the sshpass
program.
[root@corp-01 ~]# yum install sshpass Last metadata expiration check: 0:04:14 ago on Fri 19 Apr 2019 04:22:49 PM MDT. Dependencies resolved. ========================================================================================================================================================================================================================================= Package Arch Version Repository Size ========================================================================================================================================================================================================================================= Installing: sshpass x86_64 1.06-4.fc27 fedora 26 k Transaction Summary ========================================================================================================================================================================================================================================= Install 1 Package Total download size: 26 k Installed size: 38 k Is this ok [y/N]: y Downloading Packages: sshpass-1.06-4.fc27.x86_64.rpm 1.4 MB/s | 26 kB 00:00 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 196 kB/s | 26 kB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : sshpass-1.06-4.fc27.x86_64 1/1 Running scriptlet: sshpass-1.06-4.fc27.x86_64 1/1 Verifying : sshpass-1.06-4.fc27.x86_64 1/1 Installed: sshpass.x86_64 1.06-4.fc27 Complete!
sshpass -p "password" sftp -v user@server.tapetrack.com <<< $'cd upload\n put drm.csv\n ls -al'
technote/sftp.1555712879.txt.gz · Last modified: 2025/01/21 22:07 (external edit)