Monday, September 25, 2017

Ansible-Homework

# My first Ansible code:
Prabhus-MacBook-Pro:vagrant_dir AKP$ ansible example -m ping -u root -k 
SSH password: 
192.168.18.156 | SUCCESS => {
    "changed": false, 
    "failed": false, 
    "ping": "pong"

}

# List of Modules (-m option):
http://docs.ansible.com/ansible/latest/list_of_all_modules.html

# Using "module arguments" (-a) and performing another code execution:
Prabhus-MacBook-Pro:vagrant_dir AKP$ ansible example -a 'free -m' -u root --ask-pass
SSH password: 
192.168.18.156 | SUCCESS | rc=0 >>
              total        used        free      shared  buff/cache   available
Mem:           1992        1672          75          42         244          78

Swap:          2047         235        1812


Sunday, March 16, 2014

SUDO

Add user with wheel as secondary group
Visudoer
Uncomment
%wheel  ALL=(ALL)       ALL
%wheel ALL=(ALL)       NOPASSWD: ALL
Defaults env_reset,timestamp_timeout=10
ssh
PermitRootLogin No
Restart the service
$ grep password /etc/pam.d/system-auth
password    required      pam_cracklib.so retry=3 minlen=14 lcredit=-1 ucredit=-1 dcredit=-1 ocredit=-1
password    sufficient    pam_unix.so remember=3 md5 shadow nullok try_first_pass use_authtok

# By adding an user account as eswaraiah.s-admin thru visudo, it is able to login to root with his password. How to avoid the non-wheel group users to stop logging in this way?
$ %dba ALL=/bin/su - oracle