mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-17 09:25:32 +00:00
commit
407e3c57f1
31
sheets/doas
Normal file
31
sheets/doas
Normal file
@ -0,0 +1,31 @@
|
||||
# doas
|
||||
# Execute commands as another user
|
||||
|
||||
# Remove the folder of "/home/user" as user
|
||||
# If the -u option is not specified, the command will be executed as root
|
||||
doas -u user ls /home/user
|
||||
|
||||
# Show the contents of "/etc/shadow" as root
|
||||
doas cat /etc/shadow
|
||||
|
||||
# Execute the shell defined in $SHELL as root
|
||||
doas -s
|
||||
|
||||
# Permission to execute commands as another user are given in the config file "/etc/doas.conf"
|
||||
# The following line grants permission for every user in the wheel group to execute commands as root
|
||||
#
|
||||
# permit persist keepenv :wheel
|
||||
#
|
||||
# Where the option "persist" makes doas only ask for the password once in each shell session
|
||||
# Where the colon specifies that "wheel" is a group, not a user
|
||||
# And where the option "keepenv" keeps the current environment variables
|
||||
#
|
||||
# The following line rejects permission for "user" to run commands as anon,
|
||||
# if the user is not specified, it will default to root
|
||||
#
|
||||
# deny user as anon
|
||||
#
|
||||
# The following line allows "user" to execute only the program "shutdown" as root,
|
||||
# without asking for a password
|
||||
#
|
||||
# permit nopass user cmd shutdown
|
Loading…
Reference in New Issue
Block a user