Share:- Whatsapp Facebook Facebook

------------------------------------- Welcome to Developerhelpway Q&A, where you can ask questions and receive answers from other members of the community.

How to add user to group in linux?

0 votes
adding user to group in linux or ubuntu.
asked Nov 11, 2017 in Ubuntu by Nikhil Kumar

1 Answer

0 votes
Create a New Group in ubuntu:-
If you want to create a new group on our ubuntu system, use the "groupadd" command. For replacing new_group with the name of the group you want to create. You’ll need to use "sudo" command.

test@test:~$ sudo addgroup hadoop
Adding group `hadoop' (GID 1001) ...

Add an Existing User Account to a Group

To add an existing user account to a group in our system, use the "usermod" command and replacing existing group  with the name of the group you want to add the user to "testusername"  with the name of the user you want to add.

test@test:~$ sudo adduser -- ingroup hadoop hduser
adduser: Only one or two names allowed.
test@test:~$ sudo adduser --ingroup hadoop hduser
Adding user `hduser' ...
Adding new user `hduser' (1001) with group `hadoop' ...
Creating home directory `/home/hduser' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for hduser
Enter the new value, or press ENTER for the default
    Full Name []: mac
    Room Number []: mac
    Work Phone []: 2445
    Home Phone []: 1245
    Other []: test
Is the information correct? [Y/n] Y

To see ssh or sshd installed or not in our ubuntu system see the following command:-
test@test:~$ which ssh

test@test:~$ which sshd
answered Nov 11, 2017 by ranju_12 (3,520 points)