linux入门实验手册11 公钥及相关知识点

  1. 给网卡添加多个地址及删除
    ip addr add 192.168.25.166/24 dev eth0
    ip a a 192.168.25.166/24 dev eth0(简写)
    ip addr del 192.168.25.166/24 dev eth0
    ip addr {add|change|replace} IFADDR dev STRING
  2. centos7防火墙:
    systemctl status iptables
    如果上步结果为未找到,则安装:yum install iptables-services
    安装后默认为未启动,systemctl start iptables.service
    iptables -L -n 列出所有规则
    iptables -F #清除(filter表)中所有规则
    INPUT:过滤进入主机的数据包;-A:追加到规则的最后一条;
    设置完规则后重启:systemctl restart iptables
  3. 关闭防火墙:
    systemctl stop firewalld 本次禁止
    systemctl disable firewalld.service #禁止firewall开机启动,centos7以后版本;
    chkconfig iptables off centos6以前版本
  4. 创建⼀个简单的shell脚本,完成基于公钥的密码登录
    ssh服务基于密钥登录验证
    ssh-keygen –p重设私钥口令
    ssh-keygen –P Provides the (old) passphrase,-P '' 即生成的时候放空
    cat sshkeyau.sh #!/bin/bash rpm -q expect &> /dev/null || yum -y install expect ssh-keygen -P "" -f "/root/.ssh/id_rsa" userpwd="123456" while read ipaddr;do expect <<EOF set timeout 10 spawn ssh-copy-id $ipaddr expect { "yes/no" {send "yes\n"; exp_continue} "password" {send "$userpwd\n"} } expect eof EOF done < ip.txt cat ip.txt 192.168.11.118 192.168.11.235

  5. 查看chrony有效的配置⽂件
    grep -Ev "^(#.星|)$" /etc/chrony.conf;原理:(C|c)at Cat或cat,所以^(#.星)或者^$
    grep -Ev "^(#.*星|$)" /etc/chrony.conf,这个也对
    grep -Ev "^#|^$" /etc/chrony.conf
  6. rsync、pssh、sftp工具

猜你喜欢

转载自www.cnblogs.com/linux521/p/11111127.html