The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to execute a script hosted on a machine from a different machine harneetmakol Shell Programming and Scripting 2 08-11-2008 08:47 AM
Execute command from terminal on remote machine Ranu Shell Programming and Scripting 0 10-09-2007 04:13 AM
change files permission on Remote machine almeisan1 Shell Programming and Scripting 1 10-05-2006 12:03 PM
how to execute a script on remote machine balireddy_77 Shell Programming and Scripting 4 09-27-2006 07:45 PM
Need Script to check whether user exists in the remote machine Srini75 SCO 1 09-07-2005 11:23 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-01-2008
goutham4u goutham4u is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 4
Change user on remote machine and execute script!

Hi,

I need to login into remote server and execute a shell script over there.

As of now i am making use of ssh command

ssh primUser@135.254.242.2 sh /poll.sh

I am logging in as primUser but unless i change the user to root the script execution on the remote machine is not possible.

Is there a way wherein i can make use of perl script or anything like that and remotely change the user to root?

ssh primUser@135.254.242.2 su -

The above command is giving me a 'su - Sorry' message.

Can anybody help me to change the login to root on remote machine and execute the script poll.sh on it?
  #2 (permalink)  
Old 09-01-2008
dennis.jacob dennis.jacob is offline Forum Advisor  
dj -------
  
 

Join Date: Feb 2007
Location: Singapore/Bangalore/Cochin
Posts: 573
Quote:
Originally Posted by goutham4u View Post
Hi,

I need to login into remote server and execute a shell script over there.

As of now i am making use of ssh command

ssh primUser@135.254.242.2 sh /poll.sh

I am logging in as primUser but unless i change the user to root the script execution on the remote machine is not possible.

Is there a way wherein i can make use of perl script or anything like that and remotely change the user to root?

ssh primUser@135.254.242.2 su -

The above command is giving me a 'su - Sorry' message.

Can anybody help me to change the login to root on remote machine and execute the script poll.sh on it?
Configure the ssh to add the keys for the "root" on the remote server!!! . But remember it is highly risky!!!
  #3 (permalink)  
Old 09-01-2008
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,574
So configure (or install...) sudo on your remote host so that the script is executed by primUser as root...
  #4 (permalink)  
Old 09-02-2008
goutham4u goutham4u is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 4
Can any one tell me how to add keys for user root of remote server onto my present machine?

I am trying the ssh-keygen command but its giving a ssh-keygen command not found error. Any links to webpage of how to configure is highly appreciated!
  #5 (permalink)  
Old 09-20-2008
raghupc raghupc is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 2
key generation

Can any one tell me how to add keys for user root of remote server onto my present machine?

I am trying the ssh-keygen command but its giving a ssh-keygen command not found error. Any links to webpage of how to configure is highly appreciated!

============================================
check this link

System Administration Toolkit: Distributed administration using SSH

In windows machine if you have cygwin installed

goto to cygwin
mkdir -p .ssh
ssh-keygen -t dsa -f .ssh/id_dsa -P ''

then append the contents of .ssh/id_dsa.pub to /export/home/buildusr/.ssh/authorized_keys(10.18.51.62)

cat id_dsa.pub >> /export/home/buildusr/.ssh/authorized_keys
  #6 (permalink)  
Old 10-24-2008
gfca gfca is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 31
Hi,

you can run "ssh primUser@135.254.242.2 "su - user -c command_to_run"

hope this will help
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:31 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0