發表文章

目前顯示的是 2月, 2023的文章

Linux FAQ : 其他用戶沒法查看 crontab 和 無法切換到另一個用戶

圖片
  權限 root 以外用戶使用 su 切換用戶被擋住 參考 : https://cloud.tencent.com/developer/article/1020334 https://unix.stackexchange.com/questions/61876/su-permission-denied-despite-correct-password https://blog.csdn.net/master336/article/details/121972302 http://iamnotpg.blogspot.com/2015/11/crontab-e.html https://support.oneidentity.com/safeguard-authentication-services/kb/4271211/user-unable-to-run-crontab-command-due-to-error-you-username-are-not-allowed-to-access-to-crontab-because-of-pam-configuration 檢查是不是沒有 setuid chmod u+s /bin/su 測試用戶可以切換 如還是被擋住 檢查 /etc/pam.d/su 預設 wheel 群組是管理用 可以把該段註解 用戶查看排程 也需要給權限 chmod u+s /bin/crontab 如缺少 /etc/cron.deny 也會不能執行 可以給一個空檔案

Linux FAQ : 如何更改檔案 權限

  Linux FAQ : 如何更改檔案 權限 參考 :  https://superuser.com/questions/648163/recursively-chown-all-files-that-are-owned-by-a-specific-user 更改檔案 # chmod permission_number file # example : chmod 775 abc.txt # change file owner or group # chown owner file # example : chown berry abc.txt # chgrp group file # example : chgrp apple abc.txt # chown owner.group file # example : chown berry.apple abc.txt 大量調整檔案 find . -type d -iname '???' -user old_user -exec chown -R new_user:new_group {} \\; 測試情境 find . -type d -iname 'zh_TW' -user tiptop -exec chown -R tiptop:tiptop {} \\; 簡介 : 找出目錄名稱為 zh_TW 用戶為 tiptop 執行更改此目錄全部檔案 用戶 tiptop 群組 tiptop