You are not logged in.
Pages: 1
I've been trying to get my ssh agent set up for a while now, but I'm having a problem.
The two main methods (as I understand it) for getting a ssh-agent exposed to the rest of the OS is either through a systemd module or through a shell script in your bashrc. I've tried both. For some reason I don't have an ssh-agent.env / ssh-agent.socket in my /run/user/1000/ directory so every time I try to start the ssh-agent through the bashrc script or through systemd it throws the error:
bash: /run/user/1000/ssh-agent.env: No such file or directoryI've read the only other posts on this topic, and even though they're not solved I suspect this has something to do with my systemd configuration because 1. As we all know /run/user/1000 is for systemd. 2. For some reason my system doesn't have a ~/.config/systemd directory.
Last edited by muchanem (2020-07-01 15:25:15)
Offline
As we all know /run/user/1000 is for systemd.
No, it's a XDG_RUNTIME_DIR, it isn't "for" any particular application: https://wiki.archlinux.org/index.php/XDG_Base_Directory
Why do you think /run/user/1000/ssh-agent.env should exist? What have you actually done to start ssh-agent?
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Oops, I guess I don't know as much as I think I do (I'm coming from linux mint).
The command "ssh-agent" returns to normal stuff (SSH_AUTH_SOCK, SSH_AGENT_PID) along with their respective exports. A simple eval(ssh-agent) returns the PID of the agent, but doesn't make it global (new terminals cannot see the ssh-agent). I went to the wiki and first tried to add this script
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env"
fi
if [[ ! "$SSH_AUTH_SOCK" ]]; then
source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
fito my bashrc but on the start of each sesson I'd get the error bash: /run/user/1000/ssh-agent.env: No such file or directory.
I then moved on to the systemd method adding a ssh-agent.service in /etc/systemd/system
[Unit]
Description=SSH key agent
[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
# DISPLAY required for ssh-askpass to work
Environment=DISPLAY=:0
ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK
[Install]
WantedBy=default.targetNote - this method requires that you add SSH_AUTH_SOCK DEFAULT="${XDG_RUNTIME_DIR}/ssh-agent.socket" to ~/.pam_enviroment, so I quickly realised this wasn't going to work either because I don't have a ssh-agent.env and it didn't work.
It appears for either automatic method to work I need a ssh-agent.env. I'm considering using the startx method, but that would require figuring out how my greeter starts an x session, and I'd rather just figure this out.
Offline
The most obvious explanation for the ssh-agent.env not existing is that
pgrep -u "$USER" ssh-agentdoesn't exit with an error code.
adding a ssh-agent.service in /etc/systemd/system
This is not the correct place for this service file, as it's a user service.
It seems like you have seen this page, but you haven't taken the time to actually read it and understand what it is suggesting. Take the time to do so, and if things are still unclear or not working how you would expect, post back here with details of what isn't clear and/or what you tried.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
I figured it out. I assumed I just had a misconfigured systemd and didn't think I needed to create the directories in my home directory for a user service. This was wrong. Killing my already running ssh-agent and then setting up the user systemd service worked. Thank you for your help
Last edited by muchanem (2020-07-01 15:23:39)
Offline
Pages: 1