Tracy R Reed wrote:
> For a few years now I've been using this hack:
> 
> http://pastebin.ca/1023635
> 
> to automatically install my own ssh pubkey on any machine I log into.
> Very handy for a sysadmin. I think I've shown this here before. One
> thing that bugs me about doing this is that it causes my big long
> command string to show up in the ps output which makes a mess of ps. I
> am trying to change this behavior but not having much success. You can't
> change your own $0 apparently and I have tried changing the $COMMAND at
> the very end to be some form of exec -a or exec -a /bin/bash since I
> expect that this might change the $0 when the new shell gets exec'd but
> I just get logged out when the exec happens. I suspect I am losing my fd
> or tty when this happens. Any suggestions?
> 

You are talking about an ugly ps entry at the client side, I gather.

Nothing comes to mind that doesn't require a two-step (or more)
operation. Perhaps the extra step(s) can be constrained to the first
time, though.

What about
- - -
  ssh -obatchmode $DESTINATION $COMMMAND
  if [ $? -eq 255 ]
  then
    do_key_install()
    ssh -obatchmode $DESTINATION $COMMMAND
  fi
- - -

If you know the address range, maybe the "-obatchmode" can be moved into
your client config file (~/.ssh/config)
  host 192.168.17.*
  BatchMode yes
along with other client options you may wish to force.

Regards,
..jim

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to