The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 04-09-2008
prvnrk prvnrk is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 138
I setup the same scenario and it worked for me on Solaris 8 but with small change.

1. Setup password-less ssh for user "user-A" from box-A to box-B

2. setup the sudoers (/usr/local/etc/sudoers as sudo installed from SMCsudo) on box-B as below:

User_Alias USERA = user-A
Cmnd_Alias SU_USERA = /bin/test_scr.sh
USERA ALL = (ALL) NOPASSWD: SU_USERA

where "/bin/test_scr.sh" would have the below line (root must be the owner of this script)

su - user-B -c "/opt/rah/rah/rah/command.sh"

3. run the below command from box-A as user user-A

ssh box-B "/usr/local/bin/sudo /bin/test_scr.sh"

Note: On box-B, /bin/test_scr.sh will be run as "root" user who in turn "su" to user-B (root -to- user-B does not require any password)

DONE

Prvn