الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

معمل 6.1RHCSA 10, الفصل 6

Create users and groups with password rules

المستوى
سهل
30 دقيقة
الأجهزة
server1
الحالة
لم يبدأ

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

الهدف

Set the defaults for new accounts, then create a small team with groups, password rules and one service account.

قبل أن تبدأ

  • Work on server1 as root (sudo -i).
  • This is a lab: you may use the password password for every user.

المهام

  1. Make sure that every new user must change the password every 90 days and gets a file WELCOME.txt in the home folder.
  2. Create the group sales with GID 3000 and the group account.
  3. Create the users anna and bob. Both are members of sales; bob is also a member of account. Set a password for both.
  4. Create the user carol with the shell /sbin/nologin and no extra groups. Set a password.
  5. The account of bob must expire on 31 December 2026.
  6. anna must choose a new password at her next login.
  7. Lock the password of carol.
  8. Add anna to the group account without removing her from sales.

تحقّق من عملك

id anna; id bob; id carol
getent group sales account
chage -l bob | grep 'Account expires'
chage -l anna | head -2
passwd -S carol
ls /home/anna
  • anna and bob are in sales and account; carol is only in her own group.
  • sales has GID 3000.
  • bob: Account expires Dec 31, 2026. anna: "password must be changed".
  • passwd -S carol shows L (locked). /home/anna has WELCOME.txt.
  • grep PASS_MAX_DAYS /etc/login.defs shows 90.

تلميحات

اعرض التلميحات

الحل

اعرض الحل
  1. Set the defaults first.
    sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS   90/' /etc/login.defs
    echo "Welcome to the team" > /etc/skel/WELCOME.txt
  2. Create the groups.
    groupadd -g 3000 sales
    groupadd account
  3. Create anna and bob and set the passwords.
    useradd -G sales anna
    useradd -G sales,account bob
    echo password | passwd --stdin anna
    echo password | passwd --stdin bob
  4. Create carol.
    useradd -s /sbin/nologin carol
    passwd carol
  5. Expire date for bob.
    chage -E 2026-12-31 bob
  6. Force a new password for anna.
    chage -d 0 anna
  7. Lock carol.
    passwd -l carol
  8. Add the extra group to anna.
    usermod -aG account anna

ملاحظاتي

لا توجد ملاحظات بعد.

دروس هذا المعمل

الأوامر في هذا المعمل