I've learned some shells before, but not very deep, and the time to write code is not much. Shortly before the shell was more thin, leader assigned a task to write a script with the shell to upload the Redis source tarball from one server to another server, while the command on the server, unzip the source package and start the Redis service on another server.Although some shells have been learned, the SCP and expect that need to be used in this task
The most common ssh while SSH service is provided by SSHD when remotely landing on a Linux server, and sshd also provides SFTP functionality.
Here the user sftp-admin, only can sftp connect the server and cannot ssh to connect the server.
SFTP Connection: OKSSH Connection: NG
Create
Because customers in a recent project need to use SFTP to send files to me, the company's servers are WINDOWS 2003 or WINDOWS 2008, and I have to find a free one (this is important ), easy to use and stable SFTP server software.
After some painstaking efforts, I found the following:
1. OpenSSH
Reference article: "using sftp to Build Secure Transmission in Windows
SFTP command list for query. sftp command list
Available commands:
ascii Set transfer mode to ASCIIbinary Set transfer mode to binarycd path Change remote directory to 'path'lcd path Change local directory to 'path'detail remote-path Display system information about remote
Use expect to implement automatic logon script, there are many online, but there is no clear explanation, beginners are generally copied, collection. But why do you want to write this but do not know it. This article uses a shortest example to illustrate the principle of scripting.The script code is as follows:
##############################################
#!/usr/bin/expect
Set Timeout 30
Sample SFTP client code and sftp client codeSFTP client code example
Environment:Libssh2 1.4.3, zlib-1.2.8, openssl-1.0.1g
Author:Kagula
Last update date:
From Idea 2013, there are two projects in it. You only need to compile the libssh2 project. Before compilation, add the header files of zlib and openssl and the link location of the library file. If you are prompted to not find msvcrt. lib after compiling
disk usage:
!df -h
Filesystem Size Used Avail Capacity Mounted on/dev/disk0s2 595Gi 52Gi 544Gi 9% /devfs 181Ki 181Ki 0Bi 100% /devmap -hosts 0Bi 0Bi 0Bi 100% /netmap auto_home 0Bi 0Bi 0Bi 100% /home
In this way, any other local command will be as effective as you expect. Returns an SFTP session. input:
exit
Now you can see that the
Use expect to implement automatic logon script, there are many online, but there is no clear explanation, beginners are generally copied, collection. But why do you want to write this but do not know it. This article uses a shortest example to illustrate the principle of scripting.The script code is as follows:1 #!/usr/bin/expect23ssh192.168. 1.1 4 " Password: " 5 " ispass\r " 6 Interact 1. [#!/usr/bin/expect
Using the SFTP tutorial in PHP, PHP uses the SFTP tutorial
http://www.bkjia.com/PHPjc/976024.html www.bkjia.com true http://www.bkjia.com/PHPjc/976024.html techarticle PHP using the SFTP tutorial , PHP using the SFTP tutorial php/**php in the SFTP tutorial Telnet, FTP, S
Recently in the Zabbix, the company has six new servers. When the Zabbix client is deployed, the baby is really angry. Grandpa's always so repetitive work is also not AH. But as a war five slag, what else can be mixed with rice? Think of last year wrote a expect blog, so came the inspiration. God, please don't squirt me. So I decided to play a bit of technical little difficulty, remote automatic synchronization. Client software. So I revisit the
Use SFTP in Phpstorm and SFTP in Phpstorm
In Phpstorm, FTP connection failures often occur. In this case, we can use SFTP to connect to the server.
1. Add a server. Tools -- deployment -- configuration/browse Remote Host
2. Add a server and enter a name.
3. Enter the corresponding account and password port number, provided that the port and account have b
Use expect to implement automatic logon script, there are many online, but there is no clear explanation, beginners are generally copied, collection. But why do you want to write this but do not know it. This article uses a shortest example to illustrate the principle of scripting.The script code is as follows:###############################################!/usr/bin/expectSet Timeout 30Spawn ssh-l username 192.168.1.1Expect "Password:"Send "ispass\r"I
Recently in the Zabbix, the company has six new servers. When the Zabbix client is deployed, the baby is really angry. Grandpa's always so repetitive work is also not AH. But as a war five slag, what else can be mixed with rice? Think of last year wrote a expect blog, so came the inspiration. God, please don't squirt me. So I decided to play a bit of technical little difficulty, remote automatic synchronization. Client software. So I revisit the
Recently in the Zabbix, the company has six new servers. When the Zabbix client is deployed, the baby is really angry. Grandpa's always so repetitive work is also not AH. But as a war five slag, what else can be mixed with rice? Think of last year wrote a expect blog, so came the inspiration. God, please don't squirt me. So I decided to play a bit of technical little difficulty, remote automatic synchronization. Client software. So I revisit the
Recently in the Zabbix, the company has six new servers. When the Zabbix client is deployed, the baby is really angry. Grandpa's always so repetitive work is also not AH. But as a war five slag, what else can be mixed with rice? Think of last year wrote a expect blog, so came the inspiration. God, please don't squirt me. So I decided to play a bit of technical little difficulty, remote automatic synchronization. Client software. So I revisit the
background: In the remote file download, you need to enter the other party's server password, the shell does not support interactive input content, can be implemented in the following two waysI. Embedding expect in shell scripts for password entryexpect is a tool for automatic interactive functionality. Expect is a subprocess that executes a shell script through spawn, monitors the return of the script, and
Use expect to implement automatic login script, there are many online, but there is no clear explanation, beginners are generally copied, collection. But why to write this but do not know it. This article uses a shortest example to illustrate the principle of the script.
The script code is as follows:
##############################################
#!/usr/bin/expect
Set Timeout 30
Spawn ssh-l username 192.16
Recently in the Zabbix, the company has six new servers. When the Zabbix client is deployed, the baby is really angry. Grandpa's always so repetitive work is also not AH. But as a war five slag, what else can be mixed with rice? Think of last year wrote a expect blog, so came the inspiration. God, please don't squirt me. So I decided to play a bit of technical little difficulty, remote automatic synchronization. Client software. So I revisit the
Recent programming uses SFTP upload files, and need to use crontab preset timed upload events. Unlike FTP, SFTP does not provide options such as-I can encode the password directly into the program. Using the SFTP directive, the user is automatically requested to enter a password.
Summarize the three ways you can avoid sftp
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.