- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Query About SSH
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-30-2010 03:22 AM
тАО08-30-2010 03:22 AM
We need to execute one command from remote host to stop one service. Already SSH key has configured. I tried with below command. Able to connect the host But the command is not executed.
ssh -t hostname su - username
-c "/usr/sap/DAA/SYS/exe/uc/hpia64/sapcontrol
-nr 24 -function StopService"
When I run this command locally, it is working.
Help me on this to resolve this issue.
Regards
Shameem
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-30-2010 04:22 AM
тАО08-30-2010 04:22 AM
Re: Query About SSH
if you want to run command as the user "username" , you could try ssh username@hostname and then run the command .
However, the previously configured ssh keys will not work here ,as this is a different user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-30-2010 04:30 AM
тАО08-30-2010 04:30 AM
Re: Query About SSH
But I need to login as root first then only i need to login as normal user to execute the command. Because SSH Key is configured only for root account & should not be for normal user in our environment.
Is there any possibilities?
Regards
Shameem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-30-2010 04:48 AM
тАО08-30-2010 04:48 AM
Re: Query About SSH
I checked the command which is not working properly. command syntax is correct. i dont know why it is not working.
Regards
Shameem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-30-2010 05:31 AM
тАО08-30-2010 05:31 AM
Re: Query About SSH
As far as I can see already used full path, so be sure your remote server can accept the above command locally ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-30-2010 05:59 AM
тАО08-30-2010 05:59 AM
Solutiondo a straight login to the the remote server.
ll usr/sap/DAA/SYS/exe/uc/hpia64/sapcontrol
You are using the full path of the command. That should negate any environment problems.
You are also doing an su - username
These steps need to be tested individually to know which part is failing.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-30-2010 08:58 AM
тАО08-30-2010 08:58 AM
Re: Query About SSH
As others have mentioned, enabling the keys to log into the correct user the first time instead of su'ing into it is the cleaner approach.
If, for whatever reason (probably political) that's not practical, create a script that contains that line:
#!/bin/ksh
. /root/.profile # or where ever root's profile is
su - ${user} -c "/usr/sap/DAA/SYS/exe/uc/hpia64/sapcontrol
-nr 24 -function StopService"
# eof
then call the script from the ssh command:
ssh -t ${host} /root/bin/sapcontrol
HTH;
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-30-2010 11:47 PM
тАО08-30-2010 11:47 PM
Re: Query About SSH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2010 12:06 AM
тАО08-31-2010 12:06 AM
Re: Query About SSH
I tried to login directly without su as per Mr. Steven. It is working fine
ssh -t username@juepp04 "/usr/sap/DAA/SYS/exe/uc/hpia64/sapcontrol -nr 24 -function StopService"
It is failed when I use su on this command. But it is working(with su) when I start the service :). Any specific reason for this?
Also I have created script separately as per
Mr. Doug, it is working fine.
One more information, i need to run this command from cluster package. separate script is ok? or anything needs to be done ?
Regards
Shameem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 07:58 PM
тАО09-01-2010 07:58 PM
Re: Query About SSH
As long as the separate script is either in a relocatable filesystem or in the same place on both systems if using a local filesystem, you can run it from the package control script w/o issue.
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html