![sudo rootsh에 비밀번호를 전달하는 방법](https://linux55.com/image/178235/sudo%20rootsh%EC%97%90%20%EB%B9%84%EB%B0%80%EB%B2%88%ED%98%B8%EB%A5%BC%20%EC%A0%84%EB%8B%AC%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95.png)
내 ID를 사용하여 내 애플리케이션 서버에 로그인합니다. 로그인 후 다음을 통해 generic-id를 사용하여 애플리케이션 서버에 로그인했습니다.
sudo rootsh -i -u generic-id
비밀번호를 묻는 메시지가 표시되며 성공적으로 로그인되었습니다.
아래와 같이 파일이나 일반 텍스트에서 비밀번호를 전달하는 방법
echo password | sudo rootsh -i -u generic-id
cat passwordFile | sudo rootsh -i -u generic-id
위와 같이 하려고 하면 오류가 발생합니다.
tcsetattr: stdin: 장치에 부적절한 ioctl
나는 명령을 사용해 보았습니다.
echo password | sudo rootsh -i -u -S generic-id
그런 다음 오류가 발생합니다.
죄송합니다. 사용자 xxxid는 호스트에서 루트로 "/bin/rootsh -i -u -S generic-id"를 실행할 수 없습니다.
답변1
echo password | sudo -S rootsh -i -u generic-id