In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.