在远程系统上我运行 -
$ ssh root@my_host echo " address 192.168.2.150" >> /mnt/loop_mount_point/etc/network/interfaces
-bash: /mnt/loop_mount_point/etc/network/interfaces: No such file or directory
但是,如果我以 root 身份通过 SSH 登录并运行相同的命令,则不会遇到任何问题。
root@my_host:~# echo " address 192.168.2.150" >> /mnt/loop_mount_point/etc/network/interfaces
root@my_host:~# cat /mnt/loop_mount_point/etc/network/interfaces
...
address 192.168.2.150
是否有我可以使用标志ssh
或其他方法来解决这个问题?
更重要的是,如果我远程访问ls
目录,你可以清楚地看到它的内容 -
$ ssh root@my_host ls -lash /mnt/loop_mount_point/
total 112K
4.0K drwxr-xr-x 23 root root 4.0K Oct 2 02:43 .
4.0K drwxr-xr-x 7 brandon brandon 4.0K Oct 26 12:04 ..
4.0K drwxr-xr-x 2 root root 4.0K Sep 11 02:49 bin
4.0K drwxr-xr-x 3 root root 4.0K Oct 2 02:44 boot
4.0K drwxr-xr-x 4 root root 4.0K Sep 12 2018 dev
...
4.0K drwxrwxrwt 7 root root 4.0K Oct 4 08:36 tmp
4.0K drwxr-xr-x 10 root root 4.0K Sep 12 2018 usr
4.0K drwxr-xr-x 14 root root 4.0K Dec 6 2018 var
0 lrwxrwxrwx 1 root root 28 Oct 2 02:43 vmlinuz -> boot/vmlinuz-4.15.0-1051-aws
0 lrwxrwxrwx 1 root root 28 Oct 2 02:43 vmlinuz.old -> boot/vmlinuz-4.15.0-1050-aws
答案1
啊,我明白了;)
$ ssh root@my_host 'echo " address 192.168.2.156" >> /mnt/loop_mount_point/etc/network/interfaces'
不要忘记那些''
。