Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 CentOS 系统。通过 sssd/realm 有本地用户(root 等)和 Active Directory 用户。/etc/bashrc 中有没有办法测试本地用户?
我正在使用这样的结构:
GROUPS=`id -Gr $USER` for i in "${GROUPS[@]}"; do #admin check if [ $i == 199299399 ]; then
为 Active Directory 用户识别特定组。枚举所有本地组对我来说是不切实际的。
找到了这个,它适用于我的情况:
elif [[ -z `grep $USER /etc/passwd 1> /dev/null` ]]; then