如何在不登录的情况下通过 ssh 在服务器端运行命令

fl0*_*00r 3 ssh unix remote

我懒得通过 ssh 登录到我的服务器来执行一个命令。

就像我需要的那样touch /var/www/dir/file.doc。我可以做这样的事情:

srun root@mydomain.com touch /var/www/dir/file.doc
Run Code Online (Sandbox Code Playgroud)

小智 10

是的,你可以

ssh root@mydomain.com touch /var/www/dir/file.doc
Run Code Online (Sandbox Code Playgroud)