![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Security Discuss UNIX and Linux computer and network security, cybersecurity, cyberattacks, IT security, CISSP, OWASP and more. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| As root , running script as different user with su - problem | dbsupp | Shell Programming and Scripting | 4 | 12-18-2008 01:28 AM |
| running X-11 programs as root | Allasso | UNIX for Advanced & Expert Users | 8 | 12-28-2007 03:22 PM |
| Running out of Space (Root) | scorpiyanz | UNIX for Advanced & Expert Users | 0 | 08-19-2005 10:22 AM |
| Running a command or script as root | rm-r | Shell Programming and Scripting | 3 | 05-27-2005 08:58 AM |
| running a scr in rc3.d not as root, can i? | kymberm | UNIX for Advanced & Expert Users | 6 | 11-12-2002 11:50 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Running script through SSH as root
Hi all,
I have a situation where I have a shell script that I need to run remotely on multiple *nix machines via SSH. Unfortunately, some of the commands in it require root access. I know that best practices for ssh entail configuring it so that the root account cannot log in, you need to elevate to root via su after logging in with a regular account. Unfortunately, this seems to leave me in a dilemma: How in a script can I elevate to root, since it will prompt me for a password that I will not be there to enter? Or, is there some other alternative from an advanced security perspective that will allow me to log in with an account that has root level access to the machine (but isn't the actual "root" account)? Finally, just to head this off: No, I cannot set the script up in crontab to run as root at a certain time/frequency. The requirements for this script to run is: 1) SCP it to /var/tmp; 2) Execute via SSH as root or root-equivalent; 3) scrape the output; 4) Execute "rm /var/tmp/script.sh" via SSH to remove it. Any suggestions? |
|
||||
|
Unfortunately I already tried this, and at least with one utility (ioscan on HP-UX), adding the group the utility was in did not help, and adding the group assigned to the block device it was trying to read from also did nothing. In fact, documentation I found for ioscan stated it had to be run as root. (I realize this is getting HP-UX specific at this point, but I know I had this problem with some Linux commands as well -- I believe that lshal can only be run as root per it's documentation)
Last edited by irinotecan; 03-30-2009 at 04:23 PM.. |
|
||||
|
You are probably stuck with having to do this manually, if you don't want to compromise security.
One other poor choice - write a daemon - one that runs as root. Write the temp script to a protected directory via scp. Have the daemon run the script when it sees it out there, delete it, then email the output to you. Can you push back on the limitations - like no crontab? You can always explain to mgt that you may be out days when this has to run. The reason I say this - it sounds like an arbitrary decision somewhere upstream. Last edited by jim mcnamara; 03-30-2009 at 04:40 PM.. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|