Announcement

Collapse
No announcement yet.

[SOLVED] Using sudo with OTM

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED] Using sudo with OTM

    Using sudo is a great way to maintain the security of your servers while allowing application admins or implementation consultants to restart OTM as necessary. Since restarts happen frequently during implementations, giving your users this ability can help considerably - especially as the project deadlines approach!

    The main restart scripts for OTM are usually:
    (note: the path may differ depending on your OS - specifically HPUX and AIX)
    /etc/init.d/otmweb55
    /etc/init.d/otmapp55
    /etc/init.d/otmrptweb55
    The OTM user for this example is imaginatively named "otm55".

    First, ensure that the sudo package is installed on your server. If you're running Red Hat Linux, you simply need to run:

    Code:
    up2date -i sudo
    For CentOS, run:

    Code:
    yum install -y sudo
    Next, run:

    Code:
    visudo
    and ensure your sudoers configuration file looks similar to the following:

    Code:
    # sudoers file.
    #
    # This file MUST be edited with the 'visudo' command as root.
    #
    # See the sudoers man page for the details on how to write a sudoers file.
    #
    
    # Host alias specification
    
    # User alias specification
    
    # Cmnd alias specification
    Cmnd_Alias      OTM55SCRIPTS = /etc/init.d/otmweb55, /etc/init.d/otmapp55, /etc/init.d/otmrptweb55
    
    # Defaults specification
    
    # User privilege specification
    root    ALL=(ALL) ALL
    otm55 ALL=NOPASSWD:OTM55SCRIPTS
    Thats it! Now you can test by logging in as the "otm55" user and running:

    Code:
    sudo /etc/init.d/otmweb55 stop
    sudo /etc/init.d/otmweb55 start
    Finally, if you want to make things super easy, just create a quick restart script that looks like the following:

    Code:
    #!/bin/sh
    
    echo --- OTM Restart begun: `date`
    sudo /etc/init.d/otmrptweb55 stop
    sudo /etc/init.d/otmweb55 stop
    sudo /etc/init.d/otmapp55 stop
    sleep 10
    sudo /etc/init.d/otmapp55 start
    sudo /etc/init.d/otmweb55 start
    sudo /etc/init.d/otmrptweb55 start
     echo --- OTM Restart finished: `date`
    I hope this helps!

    --Chris
    Chris Plough
    twitter.com/chrisplough
    MavenWire
Working...
X