2 Get IP #
get my ip v4 via cli
ip a|grep inet -m1|cut foooo
u got shoerter idea
Yep — much shorter and cleaner 👍 Here are good CLI one-liners, from most correct to shortest.
3 Best (IPv4, non-loopback, actually usable) #
1ip -4 addr show scope global | awk '{print $2}' | cut -d/ -f1
3 Very short (still sane) #
1ip -4 a | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -n1
3 If you want the IP used for outbound traffic (often what you want) #
This is usually the best answer in practice:
1ip route get 1.1.1.1 | awk '{print $7}'
(doesn’t actually send traffic)
3 Ultra-short (but hacky) #
1hostname -I | awk '{print $1}'
⚠️ May return multiple IPs, ordering not guaranteed.
TL;DR #
If you just want the LAN IP to give your phone:
1ip route get 1.1.1.1 | awk '{print $7}'
If you want, I can give a POSIX-only version or one that excludes Docker / VPN interfaces.
.
2 SSH : ssh-add / ssh-agent #
Agent signature failed for id_ed25519: agent refused operation
That error is from SSH and means your SSH client tried to use a key via ssh-agent, but the agent refused to sign the request.
Agent signature failed for id_ed25519: agent refused operation
This is usually caused by one of the following. I’ll list them from most common → least, with fixes.
3 1. SSH agent is running, but the key is not loaded #
Check what keys the agent has:
1ssh-add -l
If you see:
The agent has no identities.→ this is the issue
Fix:
1ssh-add ~/.ssh/id_ed25519
Then retry your SSH command.
3 2. Key requires confirmation (macOS / security prompt blocked) #
On macOS, keys added with Keychain or Touch ID can silently fail if confirmation was denied or timed out.
Fix (macOS):
1ssh-add -K ~/.ssh/id_ed25519
If prompted, approve Touch ID / password.
You can also restart the agent:
1killall ssh-agent
2eval "$(ssh-agent -s)"
3ssh-add ~/.ssh/id_ed25519
3 3. SSH agent forwarding issue (very common on servers) #
If you’re SSH’ing from one machine into another and then trying to SSH again:
- Agent forwarding may be broken or not allowed
Check if forwarding is enabled:
1echo $SSH_AUTH_SOCK
If empty → agent not forwarded.
Fix (from your local machine):
1ssh -A user@host
Or in ~/.ssh/config:
1Host *
2 ForwardAgent yes
⚠️ Only do this for trusted hosts.
3 4. Key permissions are wrong #
SSH is strict about permissions.
1chmod 700 ~/.ssh
2chmod 600 ~/.ssh/id_ed25519
3chmod 644 ~/.ssh/id_ed25519.pub
Then reload the key:
1ssh-add -D
2ssh-add ~/.ssh/id_ed25519
3 5. Corrupted or incompatible key #
Test the key directly (bypassing agent):
1ssh -i ~/.ssh/id_ed25519 user@host
If this fails, the key itself may be invalid or not authorized on the server.
3 6. Using a restricted environment (Docker, WSL, CI, sudo) #
Some environments cannot access your SSH agent.
Examples:
sudowithout-E- Docker without
SSH_AUTH_SOCKmounted - CI runners
Quick test:
1ssh-add -l
If it errors → agent inaccessible.
3 Quick “fix everything” reset #
1eval "$(ssh-agent -s)"
2ssh-add ~/.ssh/id_ed25519
3ssh user@host
