rearsync.com Sync’n since 2008…
Categories: Computers, Networking, Security, linux, unix

Sometimes I find myself needing to get a file off of a box in a timely manner, but I dont really feel like playing with SCP or FTP.  I know, I know, I just wrote a post about how awesome SCP is, but sometimes I just need the file right NOW :)

We could use ‘nail’ very easily for this, but of most of the boxes I have to use lately only have sendmail available.  Since sendmail doesn’t have an explicit ‘attachment’ option like nail does, it can still be done, and heres how. You ‘cat’ out a file and pipe it through uuencode (you remember that right? :) )  and then out through sendmail.  This also works great in a shellscript.

Example:

File I want is -

filename.pgp

Run the command like this.

cat filename.pgp | uuencode filename.pgp | sendmail mcnooby@n00b.com

Shortly you should have an email in your email box (assuming the spam filter doesn’t get it first) with your filename as an attachment.  By default the email will be from your_username@hostname, if you want to change this you can use the ‘-f’ flag with sendmail.  You can even set your sendmail up to relay if you really want to get fancy.  I’m still trying to figure out how to get a message body, since this method will only allow me just to attach a file.  As always check out ~# man sendmail for all the other fun stuff.

Have fun, remember this is a very simple way to use it, so play around and do fun stuff.  And respect & <3 the |  .

Nick

Categories: Computers, linux, unix

Updated the page a little.

Played around with the Word Press database and was able to extract some recent post info for use on the front page. I have no idea what I’m going to do with this site; if anything it will probably turn into a cavalcade of crap.

Stay tuned…

Categories: Computers, Networking, Security, linux, unix

Got to get a file to another host quickly and easily? All you have open between the two hosts is SSH ?  SCP to the rescue.  SCP is part of the SSH suite, and unlike FTP, its a secure, encrypted protocol.   Here are two command that will get you using it in notime.

// This will upload some file from your local machine to a remote computer

~# scp <local_file> user@hostname:<remote_file_destination>

ex.

~# scp filename.txt n00b@mcn00b.net:/home/n00b

// This will allow you to get a file from a remote host to your machine

~# scp user@remotehost:<remote_filename> <local_filename>

ex.

~# scp n00b@mcn00b.net:/home/n00b/filename.txt filename.txt

You can also do entire directory’s by adding the -r flag.

This is a very useful command, especially if you have SSH keys setup between your two machines.  I’ll write a post about setting up ssh keys in a future post.

As always, man scp for more info.