I have been testing a new script and cannot figure out why my `cat spath` will not execute on the remote machine?
sudo ssh -p 22344 -o "PasswordAuthentication no" -o "HostbasedAuthentication yes" -l testuser 192.168.1.6 "find `cat spath` -depth"
cat: spath: No such file or directory
but this will command does work when I use it with the ticks:
sudo ssh -p 22344 -o "PasswordAuthentication no" -o "HostbasedAuthentication yes" -l saint 192.168.1.6 "cat spath"
/var/www/ /etc /var/spool /home/testuser
What is the trick?
---------- Post updated at 01:19 AM ---------- Previous update was at 12:30 AM ----------
I figured it out. Using the double quotes and backticks caused the local shell to interpret the command
sudo ssh -p 22344 -o "PasswordAuthentication no" -o "HostbasedAuthentication yes" -l testuser 192.168.1.6 "find `cat spath` -depth"
cat: spath: No such file or directory
using a single quote and using () seemed to have fixed the issue:
sudo ssh -p 22344 -o "PasswordAuthentication no" -o "HostbasedAuthentication yes" -l testuser 192.168.1.6 '(find `cat spath` -depth)'
/home/testuser
/home/testuser/caca
ssh runs remote commands as what remote user??
good day gents