SSH免密码登录配置SSH无密码登录需要配置如下步骤:1. 在本地生成公钥和私钥2. 导入公钥到本机认证文件3. 导入公钥到服务器认证文件如本地机器的用户需要免密码登录服务器下的某个用户:主要命令:#生成公钥和私钥ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa#导入公钥到本机认证文件cat id_dsa.pub >> authorized_key#导入公钥到服务器认证文件#这里先保存为tmp.pub,然后在服务器将tmp.pub追加到认证文件中scp ~/.ssh/id_dsa.pub edwinst@192.168.20.45:~/.ssh/tmp.pub#在服务器端操作,将接受到的公钥追加到认证文件中cat ~/.ssh/tmp.pub >> ~/.ssh/authorized_keys例子:48机器上的dainst用户需要免密登录45和46的edwinst用户操作步骤如下:#1.以edwinst用户登录192.168.20.45机器 cd ~/.ssh rm -rf ~/.ssh ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa cat id_dsa.pub >> authorized_key#2.以edwinst用户登录192.168.20.46机器 cd ~/.ssh rm -rf ~/.ssh ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa cat id_dsa.pub >> authorized_key#3.以dainst用户登录192.168.20.48机器 cd ~/.ssh ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa cat id_dsa.pub >> authorized_key #将公钥分别发送给45、46两台机器上的~/.ssh目录 scp ~/.ssh/id_dsa.pub edwinst@192.168.20.45:~/.ssh/tmp.pub scp ~/.ssh/id_dsa.pub edwinst@192.168.20.46:~/.ssh/tmp.pub#4.再次以edwinst用户登录192.168.20.45 cd ~/.ssh #将接受到的公钥追加到authorized_key cat ~/.ssh/tmp.pub >> ~/.ssh/authorized_keys#5.再次以edwinst用户登录192.168.20.46 cd ~/.ssh #将接受到的公钥追加到authorized_key cat ~/.ssh/tmp.pub >> ~/.ssh/authorized_keys 最终结果:48机器上的dainst用户可以免密登录45和46的edwinst用户结果测试:以dainst用户登录192.168.20.48 Ssh edwinst@192.168.20.45以dainst用户登录192.168.20.48 Ssh edwinst@192.168.20.46
sftp -b ${scriptPath}/sftp_get_filelist.txt ${user}@${IP}
#!/bin/bashpath=/homelftp -u root,123456 sftp://192.168.20.46 << EOFcd ${path}ls >> ./t.logEOFecho "OK"
u盘删除操作步骤
cmd -- diskpart --select disk 1 -- clean