Scripting

在 AIX 上替換 /etc/user 中的預設參數的腳本或命令

  • April 6, 2019

我想/etc/security/user使用腳本更改 AIX OS 中文件中的參數設置。這是範例使用者文件。

default:   
       admin = false  
       login = true  
       su = true  
       daemon = true  
       rlogin = true  
       sugroups = ALL  
       admgroups =  
       ttys = ALL  
       auth1 = SYSTEM  
       auth2 = NONE  
       tpath = nosak  
       umask = 022  
       expires = 0  
       SYSTEM = "compat"  
       logintimes =  
       pwdwarntime = 5  
       account_locked = false  
       loginretries = 6  
       histexpire = 0  
       histsize = 5  
       minage = 1  
       maxage = 12  
       maxexpired = 5  
       minalpha = 0  
       minother = 1  
       minlen = 8  
       mindiff = 0  
       maxrepeats = 2  
       dictionlist =  
       pwdchecks = 

我想用以下值替換參數值:

pwdwarntime = 5  
loginretries = 6  
histsize = 5  
minage = 1  
maxage = 4  
maxexpired = 5  
minalpha = 2  
minother = 1  
minlen = 8  
mindiff = 0  

您可以使用chsec命令來執行此操作。

chsec -f /etc/security/user -s default pwdwarntime=5 loginretries=6

man chsec完整的細節。

引用自:https://unix.stackexchange.com/questions/126250