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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 6 ■ SECURING YOUR SYSTEMS■ Note To use this on the command line, you’d just use this:ssh server.example.com -o ServerAliveInterval 60ServerAliveInterval sends a package through the encrypted channel after the specified number ofseconds of inactivity to the server, requesting a response. It’s turned off by default, and you may need toexperiment a little with the value. However, once you have the value set to work with your system, youshould be able to keep your SSH sessions connected.■ Note Most systems will have TCPKeepAlive on by default. This sends a TCP package after a period of idleness,usually two hours. This is often too long an interval to prevent disconnection. Also, TCPKeepAlive packets can bespoofed, whereas ServerAliveInterval ones can’t.6-5. ssh Options: Minimizing TypingAnother useful option to set is IdentityFile. SSH keys, ssh-agent, and keychain are useful to minimizepassword typing (see recipe 6-2). But you don’t necessarily want to use the same key for all the machinesyou log onto, which means that you need to specify -i keyfile on the command line. Alternatively, youcan set the identify file per host with a section like this in your ~/.ssh/config file:Host ssh.example.comIdentityFile ~/.ssh/example_id_rsaYou can also use the ~/.ssh/config file to set hostname abbreviations and usernames. This is usefulif you regularly log into a particular machine that has an inconveniently long name or for which youhave a different username. Here’s an example:Host longname.machine.example.comHostName lmachUser julietkemp-longnameThis, put in your ~/.ssh/config file, will enable you to log in to that machine simply by typing sshlmach rather than ssh julietkemp-longname@longname.machine.example.com. You could do somethingsimilar with a bash alias; however, since scp will also use settings from the .ssh/config file, editing thisfile is a more generalized solution and therefore superior.The -X and -Y command-line options enable X11 forwarding and trusted X11 forwarding,respectively. If you always want to forward X11 but want trusted X11 for a particular machine only, trythis:141Download at WoweBook.Com

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

Saved successfully!

Ooh no, something went wrong!