Skip to content

Commit 40be5d2

Browse files
committed
added additional note about changing root's home path when sudo'ing in a secure way.
1 parent b64ae67 commit 40be5d2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,6 +2002,12 @@ Defaults env_keep += "HOME MAIL"
20022002

20032003
Which stops sudo from changing the HOME variable when you elevate privileges. This means it will execute as root the bash dotfiles in the non-root user's home directory when you run "sudo bash". It is adviseable to comment this line out to avoid a potentially easy way for malware or a local attacker to escalate privileges to root.
20042004

2005+
If you want to retain the convenience of the root user having a non-root user's home directory, you can append an export line to /var/root/.bashrc, eg:
2006+
2007+
````
2008+
export HOME=/Users/blah
2009+
````
2010+
20052011

20062012
## Related software
20072013

0 commit comments

Comments
 (0)