Sunday, March 5, 2017

User create


for users in ram sam sita rita
do
useradd $user
# usermod -G flinstone $user
done

for group in sales markt delivery
do 
   groupadd $group
   usermod -G sales sam
   usermod -G sames sita
   usermod -G markt sita
  usermod -G delivery rita
done

066
---
600


[MYREPO]
name=My Centos Repo
baseurl=file:///opt/os_image
gpgcheck=0
enabled=1





1. Edit sudoers file
# visudo
2. Create Alias
a. User alias
UserAlias SALES = prema, bishal, pradip, kamal
b. create Command alias
Cmnd_Alias APPS = /sbin/useradd; /sbin/userdel, /bin/passwd
c. Create Host Alias
Host_Alias  HSALES = hhbs-mp-v01, dhmr-ap-v02
3. Grant the permission to the user
User_Alias Host_Alias=Cmnd_Alias
SALES HSALES=APPS

User_Alias SALES = prema, bishal, pradip
Cmnd_Alias APPS = /sbin/useradd, /sbin/userdel, /bin/passwd
Host_Alias  HSALES = hhbs-mp-v01, dhmr-ap-v02
SALES HSALES=APPS

$ sudo useradd testuser
$ sudo passwd testuser
$ id -a testuser
$ sudo userdel testuser

**********************************
Display available unit types
# systemctl -t help
systemctl command is used to manage different types of systemd objects, called units.
systemctl status name.type
systemctl status named.service

1. list all service unit on the system
# systemctl list-units --type=service
2. List all socket units that are active and inactive on the system
# systemctl list-units --type=socket
3. Check status of service chronyd
# systemctl status chronyd
# check if the process is running
# ps -p <PID>
4. Check if service is enable to start a boot
# systemctl is-enabled sshd
check if serice is active
# systemctl is-active sshd
5. Check enabled or disabled state of all services
# systemctl list-unit-files --type=service


Unit dependencies
# systemctl stop cups
systemctl stop cups
Warning: Stopping cups.service, but it can still be activated by:
  cups.path
  cups.socket
[root@rhel7-3 ~]#

to completely stop the service, you have to disable all services that this service depend up on.
# systemctl list-dependencies UNIT
# systemctl list-dependencies cups
Masking the service
# systemctl mask httpd.service
# systemctl unmask httpd.service
***************************

Three types of alias
1. User Alias
User_Alias ADMINS = prema, bishal, pradip, kamal
User_Alias SALES = john,mary,bill
2. Command Alias
Cmnd_Alias CMNDS = /sbin/useradd,/bin/passwd
CMD_Alias SCMDS = /usr/loca/bin/app2
3. Host alias
Host_Alias LSERVS = prema,bishal,pradip
User_Alias Host_Alias=Cmd_Alias
ADMINS LSERVS=CMNDS

Host_Alias LSERVS = prema, bishal, pradip
User_Alias ADMINS = prema, bishal, pradip, kamal
Cmnd_Alias CMNDS = /sbin/useradd, /bin/passwd




sales - ram sam sita
marketing - john bill, ram
hr - mary, jackson

a b c d e f g h i
1 2 3 4 5 6 7
addbc
+3
cffde - 3
amjhdh+changeme
dfsdaf+changeme
Who
md5 ->



ADMINS LSERVS=CMNDS




*******************************



No comments:

Post a Comment