![for 루프에서 ssh를 실행하고 su로 명령을 실행합니다.](https://linux55.com/image/133032/for%20%EB%A3%A8%ED%94%84%EC%97%90%EC%84%9C%20ssh%EB%A5%BC%20%EC%8B%A4%ED%96%89%ED%95%98%EA%B3%A0%20su%EB%A1%9C%20%EB%AA%85%EB%A0%B9%EC%9D%84%20%EC%8B%A4%ED%96%89%ED%95%A9%EB%8B%88%EB%8B%A4..png)
kamal@shell001:~ $ for i in `cat FILE`;do ssh $i -l localadmin 'su;ipmitool bmc reset cold';done
localadmin@server1's password:
Unknown command: su;ipmitool
누군가 ssh 방법을 제안하고 su
명령을 전환하고 실행하는 방법을 제안할 수 있습니까? 감사해요
저는 데비안 4.1.35-1([이메일 보호됨]).
sudo
작동하지 않습니다.
server1# su;ipmitool mc info
Unknown command: su;ipmitool
server1# su|ipmitool mc info
Unknown command: su|ipmitool
server1# su
root@server11:~#
su 뒤에 세미콜론이 있는 명령은 효과가 없습니다. 이 명령은 루트로 전환한 후에 작동합니다.
답변1
쉘 연산자는 쉘에서만 작동합니다.
ssh ... sh -c '...;...'