We are in the process of migrating this forum. A new space will be available soon. We are sorry for the inconvenience.

Howto: Automatic hubiC login on SSH connection.


Ryu
08-07-2015, 05:45 PM
Instead:
Code:
$ dbus-launch --sh-syntax
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-XXXX,guid=XXXXXXX
DBUS_SESSION_BUS_PID=1234
$ export DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-XXXX,guid=XXXXXXX
Here's a one-liner without copy and paste:
Code:
export DBUS_SESSION_BUS_ADDRESS=$(dbus-launch --sh-syntax | head -n 1 | cut -c 27-98
The same with “dbus-daemon”:
Code:
$ dbus-daemon --session --fork --print-address
unix:abstract=/tmp/dbus-XXXX,guid=XXXXXXX
$ export DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-XXXX,guid=XXXXXXX
One-liner:
Code:
export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --fork --print-address)
To automatically export the variable after a new SSH connection insert it in your .bashrc...
Code:
echo 'export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --fork --print-address)' >> .bashrc
... and have the .bashrc loading every time you make a connection.
Code:
echo 'source $HOME/.bashrc' >> .bash_profile
If you create a file with your password in plain text in it, you can automate the hubic login process.
Code:
echo 'hubic login --password_path=/path/to/password/file  /path/to/sync/dir' >> . bashrc
And if you're using Zsh instead of Bash (which I strongly suggest) then you just need to insert it into your .zshrc (no .zsh_profile).
Code:
echo 'export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --fork --print-address)' >> .zshrc
Greetings,
Ryu