Tuesday, August 14, 2018


Configuring sudo Access

  1. Log in to the system as the root user.
  2. Create a normal user account using the useradd command. Replace USERNAME with the user name that you wish to create.
    # useradd USERNAME
  3. Set a password for the new user using the passwd command.
    # passwd USERNAME
    Changing password for user USERNAME.
    New password: 
    Retype new password: 
    passwd: all authentication tokens updated successfully.
  4. Run the visudo to edit the /etc/sudoers file. This file defines the policies applied by the sudo command.
    # visudo
  5. Find the lines in the file that grant sudo access to users in the group wheel when enabled.
    ## Allows people in group wheel to run all commands
    # %wheel        ALL=(ALL)       ALL
  6. Remove the comment character (#) at the start of the second line. This enables the configuration option.
  7. Save your changes and exit the editor.
  8. Add the user you created to the wheel group using the usermod command.
    # usermod -aG wheel USERNAME
  9. Test that the updated configuration allows the user you created to run commands using sudo.
    1. Use the su to switch to the new user account that you created.
      # su USERNAME -
    2. Use the groups to verify that the user is in the wheel group.
      $ groups
      USERNAME wheel
    3. Use the sudo command to run the whoami command. As this is the first time you have run a command using sudo from this user account the banner message will be displayed. You will be also be prompted to enter the password for the user account.
      $ sudo whoami
      We trust you have received the usual lecture from the local System
      Administrator. It usually boils down to these three things:
      
          #1) Respect the privacy of others.
          #2) Think before you type.
          #3) With great power comes great responsibility.
      
      [sudo] password for USERNAME:
      root
      The last line of the output is the user name returned by the whoami command. If sudo is configured correctly this value will be root.
You have successfully configured a user with sudo access. You can now log in to this user account and use sudoto run commands as if you were logged in to the account of the root user.

Thursday, August 2, 2018


Configure Postfix SMTP relay office365 on OEL 6 & 7


https://linuxhowtoguide.blogspot.com/2017/03/how-to-configure-postfix-smtp-relay.html
https://www.onceuponanipsum.com/relay-mail-with-office-365-and-postfix/

Install Postfix using command below

[root@localhost ~]# yum install postfix cyrus-sasl-plain mailx

1. vi /etc/postfix/main.cf

relayhost = [smtp.office365.com]:587
mynetworks = 127.0.0.0/8
inet_interfaces = loopback-only
smtp_use_tls = yes
smtp_always_send_ehlo = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_security_level = encrypt
smtp_generic_maps = hash:/etc/postfix/generic
#smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

2. vi /etc/postfix/sasl_passwd
[smtp.office365.com]:587 o365test@expolanka.com:P@ssw0rd

3. postmap /etc/postfix/sasl_passwd

4. chown root:postfix /etc/postfix/sasl_passwd

5. chmod 640 /etc/postfix/sasl_passwd

6. vi /etc/postfix/generic
    root@edbtest.expolanka.com o365test@expolanka.com

7. chown root:root /etc/postfix/generic

8. chmod 0600 /etc/postfix/generic

9. postmap /etc/postfix/generic

10. vi /etc/aliases
mailer-daemon:  postmaster
postmaster:     root
root:   o365test@expolanka.com


11. [root@localhost ~]# newaliases


12. service postfix restart

13. echo "this is a test gmail" | mail -s "test message gmail" prmdth@gmail.com
    echo "this is a test o365" | mail -s "test message o365" o365test@expolanka.com
    echo "This is the body of the email"| mail -r"o365 mail<o365test@expolanka.com>" -s "This is the subject(E-Mail from SMTP Relay) line" pramudithad@itx360.com

14. Troubleshoot
    tail -f /var/log/maillog

  RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time https://shivanandarao-oracle.com/2012/12/05/rman-20207-until-time-or-re...