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?
goutham4u:
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!!!
vbe
September 1, 2008, 10:25am
3
So configure (or install...) sudo on your remote host so that the script is executed by primUser as root...
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!
raghupc
September 20, 2008, 6:06am
5
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
gfca
October 24, 2008, 7:24am
6
Hi,
you can run "ssh primUser@135.254.242.2 "su - user -c command_to_run"
hope this will help