•  Home
  •  Dashboard
  •  Company
    • About Us
    • Blog
    • Careers
    • Contact Us
    • Data Centers
    • Looking Glass
    • Network
    • Reseller
  •  Hosting Services
    • Infrastructure
      • iColocation
    • Compute
      • cMetal
      • cVirtual
    • Storage
      • sObject
      • sBlock
    • Networking
      • nCDN
      • nIP Transit
      • nWavelength
    • Protection
      • pBackup
      • pDDoS
  •  Solutions
    • Ecommerce
    • Finance
    • Gaming
    • Hosting
    • Management
    • Security
    • System Integrator
  •  Support
    • Community
    • Knowledge Base
    • Open A Ticket
  •  USA & Canada: 800-933-1517
  •  International: 626-549-2801
  •  Email: sales@psychz.net
  • Services
    • new-colocation-header-img
      Infrastructure
      • iColocation
    • new-compute-header-img
      Compute
      • cMetal
      • cVirtual
    • new-storage-header-img
      Storage
      • sObject
      • sBlock
    • new-networking-header-img
      Networking
      • nCDN
      • nIP Transit
      • nWavelength
    • new-protection-header-img
      Protection
      • pBackup
      • pDDoS
  • Solutions
    • Ecommerce
    • Security
    • Gaming
    • Hosting
    • Management
    • Finance
    • System Integrator
  • Dashboard

Centos - เพิ่มผู้ใช้ลงในกลุ่ม

  • Home
  • Client
  • Qa Forum
  • Centos - เพิ่มผู้ใช้ลงในกลุ่ม

Posted By: Fernando | 1 Replies | Last Reply On: May 29, 2017 05:22:11

วิธีการเพิ่มผู้ใช้ในกลุ่มใน centos?

Psychz - Nikhil

Votes: 0Posted On: May 29, 2017 05:22:11
 

คุณสามารถเพิ่มผู้ใช้ลงในกลุ่มได้ด้วยวิธีหลายวิธี คุณสามารถเพิ่มผู้ใช้ลงในกลุ่มขณะสร้างผู้ใช้เองหรือเพิ่มผู้ใช้ที่มีอยู่ในกลุ่มได้ นอกจากนี้คุณยังสามารถเพิ่มผู้ใช้ลงในหลายกลุ่ม ต่อไปนี้เป็นวิธีการและคำสั่งที่เป็นประโยชน์ซึ่งผู้ใช้สามารถเพิ่มลงในกลุ่มได้

ข้อกำหนดเบื้องต้น

ระบบปฏิบัติการ CentOS - เราใช้ CentOS 7 ในกรณีนี้

การเพิ่มกลุ่มในขณะที่สร้างผู้ใช้

กลุ่มใดสามารถเพิ่มผู้ใช้ขณะที่กำลังสร้างผู้ใช้ ไวยากรณ์ทั่วไปสำหรับเดียวกันคือ "useradd -G ชื่อผู้ใช้กลุ่ม" ในกรณีนี้เราจะสร้างผู้ใช้ "test" และเพิ่มลงในกลุ่ม "linux" พร้อม ๆ กัน

useradd -G linux test

(หมายเหตุ: ตัวเลือก "-G" ใช้ในการเพิ่มกลุ่มเป็นกลุ่มรองหากคุณต้องการเพิ่มกลุ่มเป็นหลักโปรดใช้ตัวเลือก "-g")

การเพิ่มผู้ใช้ที่มีอยู่ในกลุ่ม

ผู้ใช้ที่มีอยู่สามารถเพิ่มลงในกลุ่มได้โดยใช้คำสั่ง "usermod" ไวยากรณ์ทั่วไปสำหรับการเพิ่มผู้ใช้ในกลุ่มจะแสดงอยู่ด้านล่าง

usermod -aG ชื่อผู้ใช้กลุ่ม

ตัวอย่างเช่นเราจะเพิ่มผู้ใช้ "test1" ลงในกลุ่ม "linux" ตัวอย่างจะแสดงด้านล่างสำหรับการอ้างอิงของคุณ

usermod-aG linux test1

(หมายเหตุ: ใช้ตัวเลือก "-a" เพื่อเพิ่มผู้ใช้ลงในกลุ่มเสริมซึ่งควรใช้กับตัวเลือก "-G")

การเพิ่มกลุ่มหลายกลุ่มให้กับผู้ใช้รายเดียว

หลายกลุ่มสามารถเพิ่มให้กับผู้ใช้คนเดียวโดยใช้คำสั่ง "usermod" ไวยากรณ์ต่อไปนี้ใช้สำหรับต่อไปนี้

usermod -a -G กลุ่ม 1, กลุ่ม 2, ชื่อผู้ใช้ group3

มีคำสั่งที่เป็นประโยชน์บางอย่างที่จะช่วยคุณในการระบุกลุ่มการค้นหาเพื่อหากลุ่มที่ได้รับมอบหมายให้กับผู้ใช้ บางรายการมีดังต่อไปนี้

1. "getent group" - คำสั่งนี้ถูกใช้เพื่อแสดงกลุ่มทั้งหมดในระบบปฏิบัติการ

2. "กลุ่ม" - คำสั่งนี้ใช้เพื่อดูกลุ่มทั้งหมดที่มีการกำหนดชื่อผู้ใช้ไว้ (ไวยากรณ์: "ชื่อกลุ่ม")

3. "id" - คุณยังสามารถดูรหัสตัวเลขที่เชื่อมโยงกับแต่ละกลุ่มได้ด้วยการรันคำสั่ง id และระบุชื่อผู้ใช้ (ไวยากรณ์: "ชื่อผู้ใช้ id")

นี่คือคำสั่งบางคำที่เป็นประโยชน์ในการเพิ่มผู้ใช้ลงในกลุ่มในระบบปฏิบัติการ CentOS เราขอแนะนำให้คุณไปที่หน้า man ของคำสั่งเหล่านี้เพื่อทำความเข้าใจกับตัวแปรทั้งหมดของมัน

Was this reply helpful?

Related topics

  • CentOS 7: "เรียกว่า Red Hat 7 Lite"
  • วิธีรักษาความปลอดภัย MongoDB บน ​​Centos 7?
  • วิธีการกำหนดค่าช่วง IP บน Centos 7?
  • Is Centos 8 the last stable OS release?
  • How to check Centos Version?
  • Add user to sudoers Centos
  • Setup VPN on CentOS 8
  • Yum Update Not Working on Centos 7
  • Upgrade Centos 6 to Centos 7
  • ด้านบนแผงควบคุม Hosting สำหรับลินุกซ์
  • Installation of Lamp Stack on CentOS 7
  • sBlock - Backup on RHEL, CentOS, AlmaLinux & Rocky Linux
  • EasyApache 4: ดีขึ้นกว่าเดิม?
  • ในการเปรียบเทียบ: FreeBSD VS ลินุกซ์
  • โซลูชันเซิร์ฟเวอร์พร็อกซีโอเพนซอร์ส
Copyright © 2025 Psychz Networks,
A Profuse Solutions Inc Company
Hosting Services
Infrastructure
  • iColocation
Compute
  • cMetal
  • cVirtual
Storage
  • sObject
  • sBlock
Networking
  • nCDN
  • nIP Transit
  • nWavelength
Protection
  • pBackup
  • pDDoS
Company
  • About Us
  • Blog
  • Careers
  • Contact Us
  • Data Centers
  • Looking Glass
  • Network
  • Reseller
Policies
  • Acceptable Usage Policy
  • Privacy Policy
  • Service Level Agreement
  • Terms and Conditions
Support
  • Community
  • Knowledge Base
  • Open A Ticket
Get In Touch
  • Psychz Networks,
    A Profuse Solutions Company
    611 Wilshire Blvd #300
    Los Angeles,California 90017
    USA
  • US/Canada: 800-933-1517
  • International: 626-549-2801