1 / 9

sudo and not su

sudo and not su. that is the answer. Giving away candy instead of the candystore. Macros. Cmnd_Alias ADM = /bin/sh Cmnd_Alias OPS = /sbin/init.d/* Cmnd_Alias VENDOR_CMD = /usr/vendor/bin/* Host_Alias HOSTS = host1, host2, host3 User_Alias ADMIN = user1, user2

arnon
Télécharger la présentation

sudo and not su

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. sudo and not su that is the answer

  2. Giving away candyinstead of the candystore

  3. Macros Cmnd_Alias ADM = /bin/sh Cmnd_Alias OPS = /sbin/init.d/* Cmnd_Alias VENDOR_CMD = /usr/vendor/bin/* Host_Alias HOSTS = host1, host2, host3 User_Alias ADMIN = user1, user2 User_Alias OPER = user3, user4 User_Alias APPADMIN_VENDOR = <make-generated-list> User_Alias APP_VENDOR = <make-generated-list>

  4. Rules ADMIN HOSTS = (root) ADM OPER HOSTS = (root) NOPASSWD: OPS myname myhost = (root) ALL APPADMIN_VENDOR HOSTS = (vendor) ALL APP_VENDOR HOSTS = (vendor) NOPASSWD: VENDOR_CMD

  5. Makefile #!/bin/make # Makefile PARTS = sudoers.banner sudoers.commands sudoers.hosts sudoers.users sudoers.groups sudoers.rules all: sudoers sudoers: sudoers.built if visudo –c –f $<; then cp -p $< $@; fi sudoers.built: $(PARTS) cat $(PARTS) > $@ chown root $@ chgrp sys $@ chmod 660 $@

  6. Makefile (cont.) sudoers.groups: echo “# Group Macros” > $@ build_alias_from_csv /directory/of/spreadsheets >> $@ echo >> $@

  7. build_alias_from_csv #!/bin/sh # build_alias_from_csv dir=$1 for file in `ls $dir/*.csv` do alias=`basename $file` echo “User_alias $alias = \c” awk –F, ‘ BEGIN {sep=“”} {print “$sep$1“; sep=“, “} END {} ’ $file done

  8. cronjobs 55 * * * * (cd /net/somewhere; make > make.log 2>&1) 05 * * * * cp /net/somewhere/sudoers /etc/sudoers

  9. using sudo $ sudo –l will list all the commands you can sudo $ sudo –i will login interactively like “su –” $ sudo –u root /sbin/init.d/vendor stop $ sudo –u root /sbin/init.d/vendor stop $ sudo –u vendor –i will allow others to admin as vendor (this allows you to set the password to Non*Hashable!) $ sudo –u vendor /usr/vendor/bin/launch

More Related