13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 6 ■ SECURING YOUR SYSTEMSOne option is to use the NOPASSWD tag. This allows a user to run a particular command without givinga password:jkempclient2 = NOPASSWD: /bin/ls, /usr/bin/tailThis would allow jkemp to use /bin/ls and /usr/bin/tail without authenticating herself, onclient2.You can also specify PASSWD later in the list to limit this further:jkempclient2 = NOPASSWD: /bin/ls, /usr/bin/tail, PASSWD:/bin/killThis would allow all three commands, but for /bin/kill, jkemp would have to reauthenticate.You can also use the Defaults section to specify that a particular user should be prompted for theroot password rather than for their own password when invoking sudo. Thus, the following would givejkemp the ability to run any command on any machine as any user via sudo, but would require that sheuse the root password to authenticate:Defaults:jkempjkemp ALL = (ALL)rootpwALLThis is usually not a great idea because one of the advantages of using sudo is that you don’t have togive out the root password or indeed set one on your system at all. However, let’s consider the case of asingle sysadmin who knows the root passwords anyway. What happens if their password gets cracked bysome evildoer? If sudo is set so that the sysadmin has to reauthenticate with their own password, thenour evildoer now has root access. If, on the other hand, the sysadmin has to reauthenticate with root’spassword, then the evildoer now has another password to break before they can get root access.This logic may also apply if there’s more than one sysadmin, assuming that they all already haveaccess to the root passwords. It doesn’t apply to anyone who wouldn’t otherwise know the rootpassword. In this case, stick with the default of using your own password to authenticate.■ Note You can also use the runas_default option to generalize this. This option sets the user that a sudocommand should be run as if it’s not specified on the command line with sudo -u altuser. By default, this isroot. Set it to something else using this:Defaults:runas_defaultDefaults:jkemp runaspwnotrootNow if jkemp types sudo command, it will default to running command as the notroot user and will challenge forthat user’s password.150Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!