Voidrice: why `ssh-agent dwm` but no `ssh-agent` for i3?

Created on 30 Nov 2019  路  4Comments  路  Source: LukeSmithxyz/voidrice

Is there some reason dwm needs to run with ssh-agent but i3 doesn't? Personally I've been launching i3 too as just exec i3, but now that I see the ssh-agent dwm I'm curious if maybe it would make sense to run it under the agent too?

Without it the SSH_AUTH_SOCK wouldn't be available to shells unless its loaded elsewhere.

Most helpful comment

by running exec ssh-agent dwm or ssh-agent i3 you are not runing dwm or i3 under the ssh agent, it just runs ssh-agent and then runs dwm or i3

I don't think this is true. From the manual

If a command line is given, this is executed as a subprocess of the agent

Since the command is run as a subprocess, it should inherit the environment of the parent, which in this case is the ssh-agent? That would mean that the environment variables which the ssh-agent sets get propagated into dwm, and subsequently to everything else you run through dwm.

Try this to check

$ env | grep SSH
SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh
$ ssh-agent env | grep SSH
SSH_AUTH_SOCK=/tmp/ssh-oGTNfK7AHy2c/agent.38716
SSH_AGENT_PID=38718

as you can see, clearly running env via the ssh-agent changes the environment.

basically this repo is luke's personal setup of his own laptop/pc, you can install it, and then you can modify things to your own extent as much as you like

I'm aware of what this repo is, I was just trying to point out an inconsistency in the config, especially since it seems like it was unintentional. I might be missing something, but if the point of doing ssh-agent dwm was to make the env available through all of dwm, it would make sense to also do it for i3.

All 4 comments

by running exec ssh-agent dwm or ssh-agent i3 you are not runing dwm or i3 under the ssh agent, it just runs ssh-agent and then runs dwm or i3, as separate processes ... you can juts add ssh-agent to i3 as well in the same way (or you should be able to, never tried it, I run my ssh-agent manually only when I need it)

basically this repo is luke's personal setup of his own laptop/pc, you can install it, and then you can modify things to your own extent as much as you like

by running exec ssh-agent dwm or ssh-agent i3 you are not runing dwm or i3 under the ssh agent, it just runs ssh-agent and then runs dwm or i3

I don't think this is true. From the manual

If a command line is given, this is executed as a subprocess of the agent

Since the command is run as a subprocess, it should inherit the environment of the parent, which in this case is the ssh-agent? That would mean that the environment variables which the ssh-agent sets get propagated into dwm, and subsequently to everything else you run through dwm.

Try this to check

$ env | grep SSH
SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh
$ ssh-agent env | grep SSH
SSH_AUTH_SOCK=/tmp/ssh-oGTNfK7AHy2c/agent.38716
SSH_AGENT_PID=38718

as you can see, clearly running env via the ssh-agent changes the environment.

basically this repo is luke's personal setup of his own laptop/pc, you can install it, and then you can modify things to your own extent as much as you like

I'm aware of what this repo is, I was just trying to point out an inconsistency in the config, especially since it seems like it was unintentional. I might be missing something, but if the point of doing ssh-agent dwm was to make the env available through all of dwm, it would make sense to also do it for i3.

Nah it was flippant. There's no intentional distinction between the two. I might've just manually copied the loop from suckless's site because I think they have ssh-agent as the example, although I'd usually use exec as a reflex.

I'm going to close this issue. Both i3 and dwm have been run with exec recently and I don't see any particular motivation to change them.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hsigrist picture hsigrist  路  11Comments

LukeSmithxyz picture LukeSmithxyz  路  5Comments

manowar20k picture manowar20k  路  5Comments

LukeSmithxyz picture LukeSmithxyz  路  9Comments

AlexSyssoyev picture AlexSyssoyev  路  6Comments