Contents
What does Sudo do to the current shell?
What sudo does is create a new *sub*process that runs as root. The subprocess could be just a regular program (e.g. sudo cp runs the cp program in a root process) or it could be a root subshell, but it cannot be the current shell.
What is the special parameter 0 in sh-c?
Special parameter 0 will be set from the command_name operand and the positional parameters ($1, $2, etc.) set from the remaining argument operands. This is a more detailed sh -c example. It will download a document from Google Drive and open it up for editing on the desktop:
Which is the argument to the sh-c command?
The command following that will be run in that shell session, it will be treated as argument (positional parameter) 0 ( ARGV0 ), and the remaining portion as the argument to that command ( ARGV0 ), starting from 1 ( ARGV1, ARGV2.).
What is the sh-c flag in Ubuntu?
sh calls the program sh as interpreter and the -c flag means execute the following command as interpreted by this program. In Ubuntu, sh is usually symlinked to /bin/dash, meaning that if you execute a command with sh -c the dash shell will be used to execute the command instead of bash.
Can a substitute user use the sudo command?
In the past, admins would use su (substitute user) to temporarily switch to an administrator account. However, the su command requires a second user account and password, which isn’t always feasible. For most modern Linux distributions, a user must be in the sudo, sudoers, or wheel group to use the sudo command.
How to start a sudo command in Linux?
To start using sudo, use the following syntax: sudo [command] When the sudo command is used, a timestamp is entered in the system logs. The user can run commands with elevated privileges for a short time (default 15 minutes). If a non-sudo user tries to use the sudo command, it is logged as a security event.
How does Sudo execute a script as root?
Well sudo takes a program, and executes it as root. Eg sudo ./script.sh executes script.sh in a sub process but running as root. What does sudo source ./script.sh do however?