
Show HN: Private cloud shell history. Open source server for bashhub - nicksherron
https://github.com/nicksherron/bashhub-server
======
masukomi
Can someone explain bashub to me? I don't get it at all. Bash history is
already searchable (history | grep "foo"). Is the benefit just to be able to
easily see what you ran on some other device?

the pitch is "Never lose another command again" but you can increase the size
of your history file to be pretty enormous. Is being able to find a command
you ran 2 years ago really a valuable thing?

~~~
ajphdiv
I always find my history not complete when using tmux. I started using these
functions in my profile to collect everything. I don't remember the source of
the functions.

    
    
      log_bash_persistent_history()
      {
          [[
              $(history 1) =~ ^\ *[0-9]+\ +([^\ ]+\ [^\ ]+)\ +(.*)$
          ]]
          local date_part="${BASH_REMATCH[1]}"
          local command_part="${BASH_REMATCH[2]}"
          if [ "$command_part" != "$PERSISTENT_HISTORY_LAST" ]
          then
              echo $date_part "|" "$command_part" >> ~/.persistent_history
              export PERSISTENT_HISTORY_LAST="$command_part"
          fi
      }
    
      run_on_prompt_command()
      {
          log_bash_persistent_history
      }
    
    
      alias phgrep='cat ~/.persistent_history|grep --color'
    

I like the idea of a hub, as I do a lot of work inside docker containers and
vms -- so this could be tailored to help me collect all my history.

~~~
jdevera
I also use those. They came from here:
[https://eli.thegreenplace.net/2013/06/11/keeping-
persistent-...](https://eli.thegreenplace.net/2013/06/11/keeping-persistent-
history-in-bash/)

------
bobbob1921
Pretty cool! I’m not a big public cloud guy (but do run/manage many systems)
but will try this out. Fwiw, I currently have almost all of my systems sending
my command history to a syslog server (splunk) via constant VPNs (.bashrc and
logger) , it works surprisingly well and consistently for the amount of issues
I read about when searching for how to implement this online

------
bsagdiyev
Thanks for this! I was working on a private server for BashHub to be used at
work, but this is better than what I've got so far! It's sad that the creator
of BashHub has sat on releasing the server for awhile since it was a very
requested thing.

------
xwowsersx
Is bashhub itself secure? The FAQ says "You need an access token associated
with your user account to retrieve them." Wondering if anyone has any other
color on this.

~~~
StavrosK
To this point, is there an open source, encrypted data sync server? Some
encrypted database I can connect to and query for data, that will also do
deduplication, etc?

I'm imagining something like a shell history client storing the history on
this database, with the server having no knowledge of any of the data, but the
client still being able to easily sync it between devices.

------
cat199
OT side note I haven't been able to vent elsewhere: who decided to remove
failed commands from ubuntu shell history.. grr

~~~
nicksherron
I'm actually interested in people's opinions on this. I'm only returning
commands with exit status 0 or 130. Not sure if what the best approach is.

~~~
bsagdiyev
Maybe filter out repeats of anything with an exit code other than 0 or 130,
but still log the command itself? Sometimes I will run a command a few times
since I know we've either hit an API limit, or I'm testing incremental
changes.

