LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-30-2019, 11:08 PM
|
#1
|
|
LQ Guru
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,701
|
Tip: Setting up ssh-agent with OpenBox
I hope I'm not the only person who took forever to figure out how to properly set up ssh-agent with OpenBox.
In ~/.config/openbox/environment
Code:
eval $(ssh-agent)
export SSH_ASKPASS=/usr/bin/lxqt-openssh-askpass
I'm using Slackware with LXQt installed, so I have lxqt-openssh-askpass available. An alternative, I hear, is openssh-askpass.
Then you modify your logout action, which by default, is in menu.xml and looks like this:
Code:
<item label="Log Out">
<action name="Exit">
<prompt>yes</prompt>
</action>
</item>
You change that to:
Code:
<item label="Log Out">
<action name="Execute">
<execute>ssh-agent -k</execute>
</action>
<action name="Exit">
<prompt>no</prompt>
</action>
</item>
With that setup, you have one ssh-agent instance for each X session, which is what you want.
Add the following to ~/.ssh/config:
You'll be asked to enter your SSH key's password only once per login.
And if you're wondering what I'm even on about : Funtoo's OpenSSH Key Management articles (which introduce their Keychain ssh-agent wrapper) is a good overview:
https://www.funtoo.org/Keychain
Last edited by dugan; 06-02-2019 at 05:45 AM.
|
|
|
|
06-02-2019, 11:08 AM
|
#2
|
|
LQ Guru
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,701
Original Poster
|
Just putting this into ~/.config/openbox/environment also works:
Code:
pkill ssh-agent
eval $(ssh-agent)
export SSH_ASKPASS=/usr/bin/lxqt-openssh-askpass
If you're using sddm, you can also put it in ~/.xprofile (among other places).
|
|
|
|
06-09-2019, 10:35 AM
|
#3
|
|
LQ Guru
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,701
Original Poster
|
And this in (~/.config/openbox/environment) works for gnome-keyring, which persists SSH keys across login sessions:
Code:
eval $(gnome-keyring-daemon --start)
export SSH_AUTH_SOCK
export SSH_ASKPASS=/usr/lib64/seahorse/seahorse-ssh-askpass
EDIT: This is if you want to use gnome-keyring instead of ssh-agent.
Last edited by dugan; 06-11-2019 at 08:06 AM.
|
|
|
1 members found this post helpful.
|
06-10-2019, 07:33 PM
|
#4
|
|
Senior Member
Registered: Sep 2018
Distribution: Linux Mint 19.1 Tessa & 19.3 Tricia
Posts: 1,314
Rep: 
|
Thank you for your link to the information about Keychain.
Quote:
|
Keychain helps you to manage SSH and GPG keys in a convenient and secure manner. It acts as a frontend to ssh-agent and ssh-add, but allows you to easily have one long running ssh-agent process per system, rather than the norm of one ssh-agent per login session.
|
The article helped my understanding.
|
|
|
|
08-27-2019, 10:18 PM
|
#5
|
|
LQ Guru
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,701
Original Poster
|
For my new Manjaro i3 install, I decided to go with something similar, only using the GNOME Keyring, Seahorse and libsecret system. The only part that wasn't part of the default install is Seahorse, and that had only two dependencies.
In ~/.xprofile I put:
Code:
eval $(gnome-keyring-daemon --daemonize --start)
export SSH_AUTH_SOCK
export SSH_ASKPASS=/usr/lib/seahorse/ssh-askpass
In ~/.ssh/config:
And for git:
Code:
cd /usr/share/git/credential/libsecret
sudo make
git config --global credential.helper /usr/share/git/credential/libsecret/git-credential-libsecret
(Look, I know that I can get better integration than that, since this distro has PAM, but I'm coming from Slackware and this is good enough).
Last edited by dugan; 08-27-2019 at 11:06 PM.
|
|
|
|
10-20-2019, 07:57 PM
|
#6
|
|
LQ Guru
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,701
Original Poster
|
Just worked a bit more on my Manjaro i3 setup, and I think I finally got it.
First, when I install I do not check "Log in automatically without asking for the password."
Apparently, you cannot get an automatically unlocked keyring if you're using auto-logins with lightdm:
FS#55950 - [lightdm] [gnome-keyring] Keyring not unlocked on initial autologin - works on subsequent sessions
There's advice out there to just set "Login" keyring's password to a blank one, if you want both auto-login and auto-unlock, but I couldn't get that to work. AFAICT, the information above is currently valid.
Install Seahorse and check the "Login" keyring. It should be unlocked.
If it somehow isn't being unlocked when you log in, then make sure the "Login" keyring has the same password as your login password.
In ~/.xprofile, put:
Code:
export SSH_ASKPASS=/usr/lib/seahorse/ssh-askpass
eval $(gnome-keyring-daemon --start)
export SSH_AUTH_SOCK
In ~/.ssh/config, put:
I set git up with the libsecret credential helper:
Code:
git config --global credential.helper /usr/lib/git-core/git-credential-libsecret
The other stuff, like PAM modules, are set up correctly out of the box, and do not need to be messed with.
Last edited by dugan; 10-20-2019 at 07:58 PM.
|
|
|
1 members found this post helpful.
|
All times are GMT -5. The time now is 06:33 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|