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 SYSTEMSSo, in that first example, jkemp can use sudo on any machine to authenticate as any user and run anycommand. Basically, they can do anything they want! (If you look at the /etc/sudoers file, you’ll see thatthis is the same privilege level as root has.)To make life a little easier (and more maintainable), you can set up aliases in the /etc/sudoers file.So, instead of specifying your user directly, you can set up an alias for them:User_AliasSYSADMINSSYSADMINS = jkemp, pgillinALL = (ALL) ALLThis gives both jkemp and pgillin the same full privileges as before. (This group could just as wellcontain only jkemp.)■ Note You can also use groups that exist on the system:%adminALL = (ALL) ALLThis would give all members of the admin group all privileges.Similarly, you can limit the commands that people are able to run. Let’s say that one of your userswants to be able to stop and start their printer. You can allow them to do this with this setup:User_AliasLOCAL = ksmithCommand_Alias PRINTER = /etc/init.d/cupsdLOCAL client3.example.com PRINTING■ Note The (Runas) section is not required; if it’s left blank, root is assumed.ksmith will now be able to run sudo /etc/init.d/cupsd restart on their desktop, client3, whenrequired. The Command_Alias can also be a list of commands, and more can be added in the specificationline. You should always give the full path to a command (to make sure that it’s the command you think itis or at least that someone would have to hack the box first to change the command rather than justwriting their own version in their own directory). Also, you shouldn’t allow commands that are shells(/bin/bash, /bin/tcsh, and so on) or that you can shell out from, because this is effectively the same asallowing any command.6-12. sudo: Figuring Out Which Password to UseThe previous recipe discusses some of the basic ways of setting up sudo access. You can also set a varietyof options having to do with the use of passwords.149Download at WoweBook.Com

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

Saved successfully!

Ooh no, something went wrong!