note

  1. find the files that have been changed 6 days ago but within14 days. Also the file size should be less than 1M. When you find those files copy them into /tmp. (One command to do the above mentioned job)

find . -size -1M -mtime +6 -mtime -14 | xargs cp -t tmp

find . -mtime +6 -mtime -14 -size -1M -exec cp "{}" ./tmp \;

  1. find the files under /etc that contains “localhost”.

grep -r localhost /etc

find /etc -type f -exec grep -wl localhost {} \;

使用者權限

如果要讓一個使用者帳號停權,可以到 etc/passwd裡面修改使用者後面的user:/home/user:bin/bash/變成user:/home/user:!bin/bash/

也可以把使用者後面的x改成!,也可以用chsh user,將使用者的shell變成/sbin/nologin帳號就無法登入了

可以對群組進行增加和刪除,可以把特定使用者切換群組

groupadd rd
groupadd manager
usermod -g rd -G manager tom
it tom
groupdel rd

目錄的權限

r: 代表可以列出該目錄的檔案清單,可以利用ls指令立出該目錄的內容

w: 代表該目錄中的檔案與目錄都可以異動,例如: 寫入檔案、建立、刪除、與更名檔案與目錄

x: 代表可進入該目錄中,也就使使用cd指令進入該目錄

crach

參考網站: https://kknews.cc/zh-tw/code/3vpeby3.html

有做會加分

yum install snapd
systemctl start snapd
snap install john-the-ripper
updatedb  # 找不到命令時,更新資料庫
locate unshadow   # 顯示指令所在位置
cp /etc/passwd /etc/shadow .
unshadow ./passwd ./shadow > aaa  # 合併兩個檔案,讓passwd的user後面會顯示hash過的密碼

Linux指令