هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
When an admin adds you to a group, your running sessions do not have it yet. newgrp GROUP starts a new shell in which GROUP is your primary group (new files get this group) and the group is active.
If you are not a member, newgrp asks for the group password (if one is set). exit returns to the old shell.
طريقة الكتابة
newgrp [-] [GROUP]الخيارات 2
الأكثر استخدامًا
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 10
$ مستخدم عادي# بصلاحية root (أو مع sudo)
1Use a new group without a new login
newgrp webadmins id -gn webadminsexitto go back.2Create files with a team group
New files get the primary group sales.
3Check the active groups before and after
The new shell has the group.
4Go back to the normal group
Leaves the newgrp shell.
5Start as a new login
newgrp - salesClean environment, like a new login.
6Run one command with a group (sg)
sg sales -c 'touch /srv/sales/plan.txt'sg = newgrp for one command.
7Join with a group password
newgrp projectx Password:Works only if a group password was set (rare).
8In a script after adding a user to docker or podman groups
newgrp libvirtFor example after
usermod -aG libvirt $USERto use virsh without a new login.9Check the group of new files
Shows which group new files get.
10Best alternative: log in again
A new login gives all groups at once, not only one.
لا يوجد شيء يطابق هذا الفلتر.
انتبه
- newgrp starts a new shell; your old variables and history are not in it.
- A setgid folder (
chmod g+s) is often a better way to give files a team group.
الملفات
/etc/group, /etc/gshadow- Members and group passwords.
رموز الخروج
0 | Done (exit code of the shell). |
1 | Not allowed or the group does not exist. |