Changing to root user inside shell script

后端 未结 5 1360
不思量自难忘°
不思量自难忘° 2021-01-03 21:13

I have a shell script which needs non-root user account to run certain commands and then change the user to root to run the rest of the script. I am using SUSE11. I have use

5条回答
  •  没有蜡笔的小新
    2021-01-03 21:44

    Short version: create a block to enclose all commands to be run as root.

    For example, I created a script to run a command from a root subdirectory, the segment goes like this:

    sudo su - <

提交回复
热议问题