develog

[bash] su 로 다른 계정으로 전환하고 스크립트 실행하기 본문

카테고리 없음

[bash] su 로 다른 계정으로 전환하고 스크립트 실행하기

냐옴 2024. 5. 17. 10:30

root 계정으로 ssh 에 로그인하고

su 로 user01 계정으로 전환하고 스크립트를 실행한다

[root@dev01 ~]# su - user01 -c "~/my_script.sh"

 

su 옵션

OPTIONS
       -, -l, --login
           Start the shell as a login shell with an environment similar to a real login:

       -c, --command=command
           Pass command to the shell with the -c option.
Comments