sudo 

Send to Kindle
home » snippets » linux » sudo



Examples

# login as www-data
# -i: simulate initial login
sudo -u www-data -i

# -s: runs the shell specified by the SHELL environment variable
#     use in lieu of -i so you run your $SHELL
# NOTE: The environment variables, include HOME, are not
# reset unlike with "-i" so you could end up with root
# owned files in your user home directory!
sudo -u www-data -s

# The args following -s are passed to the shell that's
# invoked.  The shell typically exits after running that
# command.
sudo -u www-data -s ls -l


# Renew timeout for sudo credentials
sudo -v -p "[sudo]: Enter your password: "