Config sudo » Historie » Version 1
  Jeremias Keihsler, 13.01.2017 11:29 
  
| 1 | 1 | Jeremias Keihsler | h1. Configure sudo (sudoers-list) | 
|---|---|---|---|
| 2 | |||
| 3 | h2. Requirements | ||
| 4 | |||
| 5 | To install ssh you will need the following: | ||
| 6 | * a installed and supported operating system (e.g. CentOS 6.x) | ||
| 7 | * root-access | ||
| 8 | |||
| 9 | h2. Preliminary Note | ||
| 10 | |||
| 11 | @sudo@ allows any user to run commands or a shell as root. Use this with care. This is better than allow everyone access the root-shell directly as there is no easy way to trace who was root when. | ||
| 12 | |||
| 13 | This information was taken from | ||
| 14 | * http://wiki.centos.org/TipsAndTricks/BecomingRoot | ||
| 15 | * http://centoshelp.org/security/sudo-an-advanced-howto | ||
| 16 | |||
| 17 | h2. Install | ||
| 18 | |||
| 19 | @sudo@ is installed by default. | ||
| 20 | |||
| 21 | h2. Config | ||
| 22 | |||
| 23 | To configure the sudoers-list CentOS supplies the tool @visudo@. Don't use any other editor to manipulate the sudoers-list. | ||
| 24 | |||
| 25 | to edit the basic sudo.conf by | ||
| 26 | <pre><code class="bash"> | ||
| 27 | visudo | ||
| 28 | </code></pre> | ||
| 29 | |||
| 30 | if you want to add user-specific rules you might | ||
| 31 | <pre><code class="bash"> | ||
| 32 | visudo /etc/sudoers.d/user | ||
| 33 | </code></pre> | ||
| 34 | |||
| 35 | check the config by | ||
| 36 | <pre><code class="bash"> | ||
| 37 | visudo -c | ||
| 38 | </code></pre> | ||
| 39 | |||
| 40 | h2. Test | ||
| 41 | |||
| 42 | h2. Troubleshooting | ||
| 43 | |||
| 44 | If the command is not allowed to be executed you may use following commands to check the configuration: | ||
| 45 | |||
| 46 | as root | ||
| 47 | <pre><code class="bash"> | ||
| 48 | visudo -c | ||
| 49 | </code></pre> | ||
| 50 | |||
| 51 | as user | ||
| 52 | <pre><code class="bash"> | ||
| 53 | sudo -l | ||
| 54 | </code></pre> | ||
| 55 | |||
| 56 | as user | ||
| 57 | <pre><code class="bash"> | ||
| 58 | sudo -i | ||
| 59 | whoami | ||
| 60 | pwd | ||
| 61 | printenv | ||
| 62 | </code></pre> |