In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Introduction: sshpass can solve the problem of interactive password input in scp. Mainly used in scripts, the disadvantage is that it is easy to expose passwords and disclose security information.
1. Installation
Yum install sshpass
2. Use the command
Sshpass-p (passwd) scp (absolute path file) root@ (IP): / data
# if you need to add a scp-r parameter to copy a folder
3. Script mode
#! / bin/bash password=qwer user=root ip=192.168.1.100 file=/home/file.txt sshpass-p $password scp file $user@$ip:/data/
Script optimization:
1. Password, user and ip can be set as variables for input reading.
2. Multiple different IP can be set to ip_list.txt, and then loop with for
3. Files can also be in the form of for loop
4. You can add judgment, such as copying different files to different ip nodes.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.