I'm having trouble using a wildcard via ssh. The command I'm trying to run is ssh -t host "sudo ls -l /root/.ssh/id_rsa*
.
I've tried to use single quotes, and also use sudo -s
. I've also tried quoting the wildcard itself, but nothing seems to work. Other people have seemed to use some combination of these solutions, but it hasn't worked for me. Any ideas?
From what I've tried, you will have to spawn a new shell to prevent the wildcard from being expanded before authenticating as root:
ssh -t host "sudo -s bash -c \"ls -l /root/.ssh/id_rsa*\""
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With