- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: running remsh with su
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
05-11-2006 09:08 PM
05-11-2006 09:08 PM
I am trying ro run a command from server1 to remotely execute on server2. However, the command requires the following:
su diff-user
csh
source /etc/example.cshrc
./run-command-in-script
Is there a simple way to do this?
So far I have unsuccessfully tried:
server1(root)# remsh server2 su diff-user -c "csh /path/run-command-in-script"
....failed miserably :-)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2006 09:12 PM
05-11-2006 09:12 PM
Re: running remsh with su
u don't need to use su, you can remsh to other user.
# remsh host [-l username] command
GOOD LUCK!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2006 09:20 PM
05-11-2006 09:20 PM
Re: running remsh with su
I would enable a passwordless connection from root@server1 to diffuser@server2:
(as diffuser@server2): echo server1 root >>~/.rhosts
and then (as root@server1) use
remsh diffusr@server2 "csh -c 'source /etc/example.cshrc; ./run-command-in-script'"
to connect to server2.
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2006 09:31 PM
05-11-2006 09:31 PM
Re: running remsh with su
What about this script in remote server
as /tmp/test.sh
su diff-user
csh
source /etc/example.cshrc
./run-command-in-script
You run just
remsh server2 /tmp/test.sh
Chan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2006 09:38 PM
05-11-2006 09:38 PM
Re: running remsh with su
If you want to execute something under diffuser@server2, then a trusted relationship of some kind is required.
That means either remsh or ssh.
However: have you tried putting your su in a script and executing the script?
# echo "su diff-user -c 'csh /path/run-command-in-script'" > local_dir/scriptname
# chmod 750 scriptname
# rcp local_dir/scriptname server2:~/scriptname
# remsh server2 scriptname
Might work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2006 09:50 PM
05-11-2006 09:50 PM
Re: running remsh with su
remsh diffusr@server2 cmd
does not work, my .rhosts is set ok with passwordless connection (works ok with remsh server2 cmd) - but is does not like diffuser?server2.
Gives: rcmd: diffuser@server2: Unknown host
Chan,
Tried script previously but su diffuser line terminates the script because it switches user and cannot continue the script. That's why I am looking for maybe a one-liner.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2006 09:55 PM
05-11-2006 09:55 PM
Re: running remsh with su
echo "su - diffuser -c ......"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2006 10:08 PM
05-11-2006 10:08 PM
Re: running remsh with su
-l username does not work for other than root user.
Get error: remshd: Login Incorrect.
Jakes, still trying to figure yours out. Not sure it applies in my case but will do some testing anyway.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2006 10:18 PM
05-11-2006 10:18 PM
Re: running remsh with su
remsh server2 -n "your commands"
Chan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2006 10:19 PM
05-11-2006 10:19 PM
Re: running remsh with su
Here's the steps:
1) Put the call to "su" inside a script on the local server (my echo statement)
2) change the permissions on the local file (chmod ....)
3) remote copy the file (which preserves the chmod settings) to root on that side (rcp ....)
4) use remsh to execute this script, which then does an "su - diffuser -c ...." (remsh server2 script)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2006 10:53 PM
05-11-2006 10:53 PM
Re: running remsh with su
I definately see where your coming from, and this is what I have been trying for a while, however I cannot get the script to work on the local server even. In theory it should work, but its failing. Quite annoying since its quite a basic thing to do :-)
Will keep debugging.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2006 11:07 PM
05-11-2006 11:07 PM
Re: running remsh with su
I cracked it... /etc/hosts.equiv made the difference I think. The following now works:
server1: remsh server2 -l diffuser "csh -c 'source /etc/xxxx.cshrc'; /myscript"
Thanks all you guys for you help.
Safdar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2006 11:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2006 01:28 AM
05-12-2006 01:28 AM
Re: running remsh with su
That looks to be the best working solution for all in one script. Reduces user error on running from command line.
Thanks 10/10!!
Safdar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2006 01:30 AM
05-12-2006 01:30 AM
Re: running remsh with su
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2006 01:37 AM
05-12-2006 01:37 AM
Re: running remsh with su
Not to scold but you *really* should be using ssh for this.
remsh is extremely insecure - I could run ethereal or tcpdump & get your PW or compromise your .netrc file as well.
You'll fail ANY SOX audit if you're using remsh.
It's *so* 90s :~()
My $0.02,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2006 01:52 AM
05-12-2006 01:52 AM
Re: running remsh with su
Thannks for the advice, but I don't seem to have ssh on my servers running 11.11.
#ssh server2
sh: ssh: not found.
#ksh
#ssh server2
ksh: ssh: not found
#man ssh
No manual entry for ssh.
how do I get it working...?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2006 02:03 AM
05-12-2006 02:03 AM
Re: running remsh with su
The product number is T1471AA & it's available for free here:
http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=T1471AA
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2006 02:09 AM
05-12-2006 02:09 AM
Re: running remsh with su
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2006 02:15 AM
05-12-2006 02:15 AM
Re: running remsh with su
Just understand that there'll be a learning curve here.
But the upside is that it's much more versatile than remsh. For instance you can pass keys between servers & login, run remote processes, do secure ftp & copies all w/o having to pass PWs. But even if you do - they're encrypted as well as *all* data.
Rgds,
Jeff