- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- remsh loses command auguments
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
Forums
Discussions
Discussions
Discussions
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
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-27-2007 02:48 AM
08-27-2007 02:48 AM
remsh rmtserver /usr/local/bin/sudo /usr/bin/su - someuser -c "/usr/local/bin/rmt_script arg1 arg2"
When the script runs on the remote server the two arguments are not being received. (I reference $1 and $2 to save them into variables, and they are blank).
If I run the command directly on 'rmtserver':
/usr/local/bin/sudo /usr/bin/su - someuser -c "/usr/local/bin/rmt_script arg1 arg2"
it runs fine. So it seems that somehow using remsh drops the arguments.
I have tried all sorts of single quotes, double quotes, etc yet have not been able to find some way of making the two arguments gets passed to the remote server. Anyone have any ideas?
Scott
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2007 02:54 AM
08-27-2007 02:54 AM
Re: remsh loses command auguments
/usr/local/bin/rmt_script
echo $# "That was the number of arguments"
Let's see if its getting aruguments or if it is confused.
We are tyring something complex. We sudo to run su to a user to run a commmand.
Other ideas(for grins)
Try the same thing with ssh openssh/secure shell. It might act differently.
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-27-2007 02:58 AM
08-27-2007 02:58 AM
Re: remsh loses command auguments
I did put some of that code in:
echo $#
And get this when I run it with remsh
+ echo 0
I do see the whole setup is a bit odd. I have a script running as user1 to sudo a command that then su's to run as user2. So sudo is just my facilitator to allow this.
Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2007 03:52 AM
08-27-2007 03:52 AM
Re: remsh loses command auguments
also, why are you using sudo to run su? wouldn't sudo -u username work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2007 03:54 AM
08-27-2007 03:54 AM
Re: remsh loses command auguments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2007 03:58 AM
08-27-2007 03:58 AM
Re: remsh loses command auguments
I was not familiar that sudo could be used to switch to anything other than root, so I can try that option and see what happens.
The arguments being passed right now are literals (during my initial testing), but later on will be variables.
Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2007 04:00 AM
08-27-2007 04:00 AM
Re: remsh loses command auguments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2007 04:02 AM
08-27-2007 04:02 AM
Re: remsh loses command auguments
Simply and rectify.
Change the script so it does nothing but echo arguments on the other end, or work with a cotpy.
Then as root, try and get things working.
Once that is resolved, than add sudo to the mix and play with the quotes some more.
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-27-2007 04:06 AM
08-27-2007 04:06 AM
Re: remsh loses command auguments
simple script, then
1) remsh the script w/literals
2) remsh script w/ variables (double qouting should, ie remsh srvx "script $a $b")
then start w/ sudos and su
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2007 04:52 AM
08-27-2007 04:52 AM
SolutionThat being said, I think that this stands a chance of working , but I can't test it because I don't have remsh working anywhere.
remsh rmtserver "/usr/local/bin/sudo /usr/bin/su - someuser -c \"/usr/local/bin/rmt_script arg1 arg2\""
Just quote the remote shell command, and sub-quot the sudo command with backslashes, so that they are not evaluated unto the sudo command gets the strings.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2007 05:44 AM
08-27-2007 05:44 AM
Re: remsh loses command auguments
That did the trick!
I agree with the ssh comment, and we are moving in that direction with new servers, but sometimes you just have to work with what you have at the moment.
Thanks!