#模块安装 yum install -y augeas python-augeas #测试使用: >>> import augeas >>> a = augeas.Augeas() >>> a.get("/files/etc/sysctl.conf/net.ipv4.ip_forward") #查看/etc/sysctl.conf配置文件的net.ipv4.ip_forward参数值 u'0' >>> a.set("/files/etc/sysctl.conf/net.ipv4.ip_forward",'1') #修改/etc/sysctl.conf配置文件的net.ipv4.ip_forward参数值 >>> a.get("/files/etc/sysctl.conf/net.ipv4.ip_forward") u'1' >>> a.save() #保存修改
转载于:https://blog.51cto.com/j99d99/1829321