1.-The first this is define a group where we need to have the group id and the name of the group
-bash-3.2# groupadd
usage: groupadd [-g gid] group
-bash-3.2# groupadd -g 200 test
-bash-3.2# cat /etc/group | grep test
test::200:
-bash-3.2#
2.- Now we need to create the user and associate it to the group and the home directory
Create a home directory
-bash-3.2# mkdir -p /export/home/test
Change the permission for home user to user test and group test
-bash-3.2# useradd -u 200 -g 200 -d /export/home/test -c "test user" -s /bin/bash test
3.- Change the password
-bash-3.2# passwd test
New Password:
Re-enter new Password:
passwd: password successfully changed for test
-bash-3.2#
4.-Now you can check that user is available to login in the server
-bash-3.2# su - testOracle Corporation SunOS 5.10 Generic Patch January 2005
-bash-3.2$ pwd
/export/home/test
-bash-3.2$
5.-If you need to delete the user you have to form to do it
With -r option you Remove the user's home directory from the system, the home directory will no longer be accessible
-bash-3.2# userdel -r test
However if you need to store the home directory information you can use userdel without option
-bash-3.2# userdel test
6.-Delete the group
-bash-3.2# groupdel test
7.-Change the group to the user test to oracle group
-bash-3.2# id testuid=200(test) gid=200(test)
-bash-3.2#
-bash-3.2# usermod -g oracle test
-bash-3.2# id test
uid=200(test) gid=100(oracle)
Comments