My goal is to get all IP addresses logging into my web server, by checking access log files:
$ ls -la /var/log/nginx/access.log*
/var/log/nginx/access.log
/var/log/nginx/access.log1
/var/log/nginx/access.log2
...
...
Running the command above locally works:
$ sudo grep loging /var/log/nginx/access.log*
But when I'm trying to run from a remote host
$ ssh remote-server 'sudo grep login /var/log/nginx/access.log*'
It returns:
grep: /var/log/nginx/access.log*: No scuh file or directory
Any idea on what I am doing wrong?
One possibility I have found is calling command through bash as an example:
ssh user@host '/bin/bash -c "grep /etc/*"'
Actually, it is not a ssh
issue, the problem is with sudo
which takes argument literally, check here.
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