Wednesday, April 17, 2013

Useradd command examples                                                 usermod command examples

Groupadd command is used to create a new group account using the specified values with options or default values from the system. All information related to the group added into the system files as needed. There are many options present in group add command to change account settings of group.

We will understand all major options of groupadd command with examples:

How to create new group ?

Suppose, we want to create a new group and but we are not sure given group ID is used somewhere or not. So, in this case we can use –f option with –g option to create group forcefully. i.e. if gid is already used then it will take new gid and create the group.

As below example, 1010 gid is used already but due to –f option, command executes and it has taken next group ID i.e. 1011.

root@rhel:~# cat /etc/group | grep test
test1:x:1010:
root@rhel:~# groupadd -fg 1010 login
root@rhel:~# cat /etc/group
login:x:1011:

How to create system group?

We can create system group with –r option with groupadd command. The numeric id of system groups always chosen in the SYS_GID_MIN-SYS_GID_MAX range, which is defined in login.defs instead of GID_MIN-GID_MAX

root@rhel:~# groupadd -r hello
root@rhel:~# cat /etc/group | grep hello
hello:x:999:
root@rhel:~#
Groupdel Command 

Groupdel command is used to delete a group. Before deleting the group, we need to must take care of following things:
  • We can’t remove the primary group of any existing user.
  • We need to remove user first and then group
  • For safe side, we need to check all file systems to ensure that no files owned by this group.

Groupdel Command example:

[root@rhel ~]# groupdel test
[root@rhel ~]#



How to turn of startup services in Linux                                     Check java Performance Statistics
Posted by Machindra Dharmadhikari On 4/17/2013 09:14:00 PM 2 comments

2 comments:

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

    Chitika Ads 2

    Histat

    About

    Enter your email address:

    Delivered by FeedBurner