![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| remote ssh commands help | jcalisi | Shell Programming and Scripting | 4 | 03-04-2009 11:39 PM |
| Can BASH execute commands on a remote server when the commands are embedded in shell | bash_in_my_head | Shell Programming and Scripting | 1 | 12-04-2008 01:51 AM |
| commands to remote sftp | chm0dvii | Shell Programming and Scripting | 0 | 08-07-2008 07:23 PM |
| display remote commands | ndegem | SUN Solaris | 4 | 01-23-2008 12:24 PM |
| Remote commands problem using RSH & Rexec | fhuwaidy | UNIX for Advanced & Expert Users | 0 | 01-15-2008 04:22 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
So, HostB has a SSH trust via pre-shared keys from HostA.
HostA> ssh HostB hostname HostB HostA> ssh HostB echo `hostname` HostA HostA> ssh HostB 'echo `hostname`' `hostname` HostA> ssh HostB "echo `hostname`" HostA HostA> ssh HostB echo $PS1 user@HostA:$PWD HostA> ssh HostB 'echo $PS1' $PS1 I'm at a loss for how to get these types of commands to run remotely. Echo seems to always interpret locally. sshd_config is setup for PermitRootLogin forced-commands-only. The authorized_keys is setup for command=$SSH_ORIGINAL_COMMAND ssh-dss <key> user@HostA Just including that in case it's somehow causing my grief, though it seems more like quoting, trapping, etc. The idea is this will be used on many systems to run a command, and it'd be nice to be able to prefix returns w/ a hostname for example. Locally, I could run: echo "`hostname`: `df -g /tmp|tail -1`" and get HostA : /dev/hd3 16.00 4.06 75% 7655 1% /tmp So that way, if I script to run against a large amount of hosts, I get a hostname prefix for easy output reading. Though the redirect also brings up another question. If I do HostA> ssh HostB cat /etc/passwd|grep user user::100:100:<snip> Is the grep happening remotely, or is the grep happening locally after the data is returned? Thanks in advance for any insight you can offer. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|