linux基础

ansible批量更改密码 playbook适合部署中大型项目,需要先规划
# cat play.yml
--- - hosts: test #ansible的hosts子组 gather_facts: false #决定是否开启收集功能 tasks: - name: change user passwd #任务名称 #使用ansible的user模块批量修改用户密码 user: name={{ item.name }} password={{ item.chpass | password_hash('sha512') }} update_password=always with_items: - { name: 'root', chpass: 'admin#123' } #更改root用户密码 - { name: 'app', chpass: 'app@123' } #更改app用户密码
ansible在修改用户密码的时候不能使用明文的方式,需要用一种方法对输入明文的密码密码进行加密

 抓包

https://www.wireshark.org/download.html

tcpdump -i any -nn host 192.168.192.151

tcpdump -i any -nn host 192.168.192.151 -w k8s.cap

 ntp配置

k8s中各微服务需要时间一致,因此k8s node节点需要配置ntp保证时间一致

root@IP1:~>cat ntp.conf |grep -v "#" |grep -v "^$"
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
server IP2
logfile /var/log/ntp.log
root@T180PC06VM63:~>cat /etc/ntp.conf |grep -v "#" |grep -v "^$"
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
server IP-ntp服务器
logfile /var/log/ntp.log

重启ntp服务成效

文件相关信息:metadata, data
每个文件有三个时间戳:
access time 访问时间,atime,读取文件内容
modify time 修改时间,mtime,改变文件内容(数据)
change time 改变时间,ctime,元数据发生改变
[root@localhost ~]# stat /etc/passwd
  File: /etc/passwd
  Size: 2548          Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 134840055   Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2022-03-25 20:10:21.501147392 +0800
Modify: 2022-03-25 20:10:21.470146822 +0800
Change: 2022-03-25 20:10:21.471146841 +0800
 Birth: 2022-03-25 20:10:21.470146822 +0800

find /data/ –name "*.jpg" -mtime +365 |  xargs gzip

find /data/ –name "*.jpg" -mtime +365 |  xargs ls

find /data/ –name "*.jpg" -mtime +365 |  xargs rm -f 

管道符 前面的输出 是后面的输入

xargs 更像一个筛选器,将符合管道传递过来文件名的内容一并处理掉,这是一个极度高效的方法

 

posted @ 2021-11-28 20:34  gg888666  阅读(39)  评论(0编辑  收藏  举报