Have you ever needed to create a file of a specific size? Not where the contents are anything specific, but you just need a file that is whatever size so you can test disk I/O or network transfer speed or whatever it is you want to test. For whatever reason, I have found it very handy to be able to create these test files when needed, so I thought I would pass along some tips to that end. Here are some ways you can accomplish this with Solaris and Linux.
Category Archives: Library
Working with cpio files
Have you ever downloaded a cpio file and wondered what the heck you were going to to with it? I get them from Oracle all the time, and the first time I downloaded one I wasn’t sure what to make of it. In the end, I found that working with cpio files is a breeze, so I thought I would pass on some information that might help.
Ok, just what is a cpio file? A cpio file is an archive, and it is a concatenation of one or more files. Each file in the collection contains a header optionally followed by file contents as indicated in the header. The end of the archive is indicated by another header describing an empty file named TRAILER. There are two types of cpio archives, differing only in the style of the header. ASCII archives have totally printable header information, so, if the files being archived are also ASCII files, the whole archive is ASCII. By default though, cpio writes archives with binary headers.
How do we work with these archive files? Easy. Here is an example, say you download a gzipped cpio file:
- First, download filename.cpio.gz and use gzip to uncompress.
- Then use cat filename.cpio | cpio -icd to extract to contents.
There you go, when you are done, the contents of the cpio file should be extracted to where ever you put the cpio file and ran the command. If you want to create an archive, you can pass a file list, like with find to the cpio command and have it create an archive, much like tar does. In my own experience, I prefer tar, but if you have cpio and don’t have tar, it’s better than nothing! Check out this page for more details, a nice article from Linux Journal.
Download Internet Explorer 6
Here is a tip that may help some of you out there that are working with Windows and Internet Explorer, which can get kind of quirky at times. I don’t know about any of you, but I have found it rather annoying that I can’t download Internet Explorer 6 from Microsoft’s website, other than the online installer that downloads as part of the install. Well, here is a way to use that installer to download the source files so you can perform an off-line installation, which has been useful for me sometimes.
Good password practices
Passwords, and why the heck are they so important?
Everyone has passwords, some have only a few, and some of us have bunches of them. In some cases, literally hundreds or thousands to manage, and let me tell you it’s a pain in the rear. However, password management is not the main thing this article is about, although it pertains to the subject. No, what I want to talk about today is the area of good passwords, strong passwords, passwords that will defend your server and shun any attack by the bad guys that try to get in while you are away playing Quidditch. I have seen lots of passwords in my day, and let me tell you that there are lots of servers that could be compromised using either “ncc1701” or “corona”.
Basics of securing a Linux server
One of the most important jobs that someone who calls themselves a “System Administrator” has is securing their servers. Whether it’s a personal server you are tinkering with, or a production server at work somewhere, keeping a server secure is paramount for many reasons, not just keeping your data safe. If your server were to get compromised, depending on what happened, it could be used as a zombie to target other machines in a massive DDoS attack. It might be used to send yet more spam out to the users of the world, or it could even be setup as a platform to launch more viruses and attacks against unsuspecting users all over the Internet.
The point is that there are a great many reasons to keep your server secure, and I don’t think there is anyone out there who would disagree. That being said, I have written up some basic steps that I go through to begin the process of securing my Linux boxes, thus hoping you can use it to help you secure yours. I decided to start with Linux because many people are testing and playing with it since it is very powerful and free. These are guidelines, as well as examples of how I do it. It’s too simple to say that there are better or worse ways of doing things. Read what I have below here and apply it to your situation, lots of things in this article can even be applied to Windows, as they are good practices regardless of the OS. Let’s get started shall we?
Solaris and CD ROMs
Here’s a quick tip for anyone who is tinkering with a Solaris box, and it stems from a question I get from folk who are new to Solaris, and that is “How do I mount a CD ROM?”. The short answer is to use the mount command, but there is a little more to it. You need to know what device your CD drive is, and the easiest way to find out if you don’t already know, is to use the iostat command, specifically running it with -En so that the (iostat -En) results look like this:
c0t0d0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Model: ST3120026A Revision: 8.01 Serial No: 4JT0S129
Size: 120.03GB <120034123776 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0
c0t2d0 Soft Errors: 4 Hard Errors: 0 Transport Errors: 0
Vendor: TSSTcorp Product: CDW/DVD TS-H492C Revision: SI00 Serial No:
Size: 0.00GB <0 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 4 Predictive Failure Analysis: 0
From the output you can see that one drive is a hard drive by the line Model: ST3120026A and Size: 120.03GB, and the other drive is the CD ROM then because it says Vendor: TSSTcorp Product: CDW/DVD. There you go, find the one that says it’s a CD ROM and we know the device we need to mount is c0t2d0.