Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wildcard over ssh not working [closed]

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?

like image 856
Shail Patel Avatar asked Oct 10 '13 17:10

Shail Patel


1 Answers

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*\""
like image 51
n.st Avatar answered Oct 01 '22 10:10

n.st