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 SYSTEMSHost desktop.example.comForwardX11Trusted yesHost *ForwardX11 yesSince ssh picks up the first option it encounters, for desktop.example.com that first setting will beused, while all other hosts will fall through to the second setting.6-6. Transferring Files Over an Existing ssh Connectionssh is an excellent and essential tool, but it does have one major lack: the inability to transfer files withina session. Of course, you can use scp for this job, but it’s a nuisance to have to fire up anotherconnection for the transfer when you’re already connected to that machine!A possible solution is ssh-xfer, which uses the local SSH agent to transfer files using an existingconnection. It can also do this over multiple connections, which means that if you’ve ssh’d into desktopA and then through that to server B, ssh-xfer will allow you to transfer a file directly from server B toyour local machine.■ Note ssh-xfer is limited in that, at least currently, you can transfer files only from the remote machine to thelocal machine, not vice versa.Unfortunately, currently ssh-xfer isn’t a standard part of the ssh setup, so you’ll need to patch yourssh-agent locally and install the ssh-xfer binary remotely. However, you can put the binary in your owndirectory on the remote server, so you don’t need root access to that machine.To get this set up, you’ll need the OpenSSH source code locally so you can apply the patch and buildthe ssh-xfer binary. Download the OpenSSH patch from the ssh-xfer web site at http://matt.ucc.asn.au/ssh-xfer/, and save it to the OpenSSH source directory. Then run the followingpatch -p0 < patch-file-nameNext, build the ssh-xfer binary, in the same directory, with this:./configure; make ssh-xferFinally, you must transfer the ssh-xfer binary to the remote server:scp ssh-xfer myuser@remote.server.example.com:bin/ssh-xferNow, run a bash shell via the new agent on your local machine:ssh-agent-xfer bash142Download at WoweBook.Com

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

Saved successfully!

Ooh no, something went wrong!