Running ssh u@h command arguments
works as expected:
$ ssh verence@dock df /run
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 6551280 1888 6549392 1% /run
If I add a shell on the remote host, the argument seems to be lost:
$ ssh verence@dock sh -c 'df /run'
Filesystem 1K-blocks Used Available Use% Mounted on
udev 32730924 0 32730924 0% /dev
tmpfs 6551280 1888 6549392 1% /run
/dev/nvme0n1p2 1920224544 17109596 1805499128 1% /
...
I'm probably missing something obvious here, but didn't find any clues. What is happening here?
ssh u@h sh -c 'echo; df /run'
works as expected, so it doesn't directly seem to be a quoting issue. – nohillside Feb 28 '23 at 08:30sh -c echo; df /run
on the remote. In your original case you runsh -c df /run
. – Kamil Maciorowski Feb 28 '23 at 08:32