服务器 Gind.cn
  • Linux
  • Windows
  • Ubuntu
  1. 服务器 Gind.cn
  2. bash linux ssh
  3. 以sudo身份通过SSH运行多个命令
Intereting Posts
Solaris 10新磁盘发现 fprintd:**消息:没有使用的设备,退出 如何解决dpkgerror handling包google-cloud-sdk AD / DNS服务器 使用MPLS和IPSEC隧道进行networking平衡/故障切换 如何加快应用模拟权限的变化? 使用可靠的vsphere_guest将自定义属性分配给虚拟机 从Python程序读取stdin通过terminal中的SSH启动 2008 Windows Server R2将域networking更改为公用networking重新启动后 用于win32的预编译的Iperf 2.x二进制文件? Apache拒绝CIDR范围,但允许在该范围内的IP 在SQL Server中恢复数据库时,不能覆盖mdf文件 SQL Server 2012备份不压缩 内核模块将不会加载NFS / RoCE Ubuntu 16.04与最新的驱动程序/软件 Python程序不是由FreeBSD 7.1中的rc.d启动的

以sudo身份通过SSH运行多个命令

我试图通过SSH运行sudo命令,但没有成功:

ssh -t -p 2222 name@server /usr/bin/sudo << EOF chmod ur /xy chmod +x /xy /xy sleep 5 ps aux | grep xy sleep 5 exit EOF 

这不起作用。 没有-t和/ usr / bin / sudo:

 sudo: no tty present and no askpass program specified 

单行命令正在工作:

 ssh -p 13001 -t name@server 'sudo /xy' 

  • Bash脚本:监视热文件夹和部分文件
  • 如何在centos中使用crontab执行bash脚本?
  • debian bash / shstring执行
  • 在shell脚本中使用logging器
  • 从ssh和镜像尾部到一个本地文件

  • 如何从networking计算机获取netbios名称? (Linux)的
  • 请解释这个BASH代码(一行)
  • 如何绕过sudo
  • 为什么我无法在Bash中捕获AWS EC2 CLI输出?
  • 使用bash脚本更改MySQL root密码

这应该工作:

 ssh -t -p 2222 name@server "/usr/bin/sudo bash -c 'chmod ur /xy; chmod +x /xy; ...'" 
  • Bash片断,看看有什么东西在港口上听?
  • 如何做dos2unix到* .tplrecursion在Linux中?
  • 传递variables的问题 – Bash
  • 查找填满磁盘空间的文件/文件夹
  • 我如何恢复默认的bashrc?
  • 谁决定了Linux中的默认shell提示符?
  • 如何清除bash日志的历史logging? 另外,不要logging我的任何用户的bash日志?
  • bash脚本 – 产卵,发送,交互 – 命令未find错误
  • 使用“触摸”来创build目录 – recursion地创build目录的“影子”副本
  • 命令不在crontab中执行,而命令本身工作得很好

  • © 2017 服务器 Gind.cn
  • Topics
  •        
  • Powered by Server
  • Privacy Policy