A couple of links with lists of the default set of Linux daemons installed on most systems. Helpful to know which ones that you need to disable when locking down a machine.
Category: Ryan’s Internet Technology, and Web Design Blog
Deleting a File Using the Inode Number
Sometimes you will accidentally create a file that has special characters in the file name which then prevents you from running commands on it. In that case, you can resort to accessing the file via it’s inode number.
To do so:
$ ls -il | more
In the directory in which the file that you want to examine resides
This will output a list of files, the first column being the inode number.
You can then run the following command to delete it, where 123456789 is the inode number:
$ find . -inum 123456789 -exec rm -i {} \;
Of course, you can -exec other commands to modify the file as well.
Retuning a MySQL Query in CSV
The following is an example of how to run a query on the command line to output the result of a MySQL query to a CSV file.
Create a text file with the your query, query.sql:
SELECT * FROM hosts;
The run the following command:
mysql –skip-column-names -uuser -ppassword database < query.sql | sed ‘s/\t/”,”/g;s/^/”/;s/$/”/;’ > filename.csv
This will run the MySQL query and output the results to a text file in .csv format.
The sed commands do the following:
Replace all ‘tabs’ with “,”
s/\t/”,”/g;
Print a ” at the beginning of the line
s/^/”/;
Print a ” at the end of the line
s/$/”/;
If you have a single column of data that is returned and want that in CSV, run an additional sed command on the output:
sed ‘:a;N;$!ba;s/\n/,/g’ > filename.csv
Retrieving a Previously Deleted File in Subversion
Let’s say that you have deleted a file (or directory) in your checked out copy of a svn repository and then checked it in (committed your change).
You discover that you really would like to have that file back in your current version of your repo. You can either us the svn merge command, or copy the file from a previous version of your repo.
Here is how you can copy the file from a previous version:
svn rm blah.txt
svn commit blah.txt -m “removed blah.txt”
(now you are at version 15)
Make a number of other commits/changes, and now you want blah.txt back from version 14.
svn cp url/to/repo/blah.txt -r14 blah.txt
svn commit blah.txt -m “retrieved blah.txt from r14”
Setting up Proxy Authentication for a Linux Box to use yum
Should you find yourself running a Linux box behind a proxy that requires authentication you will need to update your setup so that you can get access to the outside world, and make some configuration changes to yum.
First, add the following to your /etc/yum.conf (note, this is incredibly insecure as you will now have your proxy uid and password in clear text on your machine. You should remove your login details after you have made your connections):
proxy=http://proxy_url:80
proxy_username=uid
proxy_password=passwd
Secondly, if you want to have access to the outside world for other processes you’ll need to edit your .bash_profile and add the following (again, this is really insecure):
http_proxy=http://uid:password@proxy.url.com:80
source your .bash_profile and now you should be able to authenticate to the proxy server.
Mount Your Motorola Droid Under WinXP
An Excellent Beginners Tutorial for Apache Ant
A Library of Pre-Configured, Linux, VMWare Guests
A collegue pointed me to ThoughtPolice.co.uk:? a website with an entire library of VMWare images of various Linux distros.
Want
to play around with some different distros of Linux, here’s a great way
to try out a wide selection really quickly (as long as you have a lot
of bandwidth).
How To Remove Desktop Security 2010
My parent’s Win XP box became infected with Desktop Security 2010 and I was tasked with it’s removal and cleanup.
Following are the steps that I took, some of which required some additional digging and experimentation that was not in the top 10 or so search results.
The first hurdle was to actually get access to the Windows Desktop.
In this case when the machine booted to Windows the Desktop Security 2010 program would essentially take over the machine. I had no access to the Desktop or any othe Windows GUI.
I clicked on DS2010 close button and after some cogitation decided to click on the Yes or Cancel buttons (I don’t remember which) to actually close the first DS2010 window.
In my case, I was left with a blank screen, no Desktop. To get explorer to launch I did the following:? Ctrl+Alt+Delete. This brings up the Task Manager.
Select File/Run and in the Run dialog box enter “explorer.exe” and click “Enter”.
In my case, that ran explorer and now I had access to the Desktop.
Now that I was able to use the Win GUI I downloaded the following to enable me to kill the currently running DS2010 processes. Click here to download rkill.com (I can vouch for the validity and benign nature of this program).
Then, I downloaded a copy of Malwarebytes’ Anti-Malware. You may have to rename both the name of the installer and the name of the .exe file that it installs so that it will run properly. In my case, that is what I had to do to get the mbam.exe to run.
I updated the software, and then ran a full scan. After the full scan ran I clicked on “Remove Selected” and then rebooted per it’s suggestion.
Unfortunately, it did not remove DS2010 and I did the following:
Ran rkill.com again, and then, by hand, deleted each of the executable files that rkill indicated it had killed.
Then I ran the Malwarebytes’ Anti-Malware scan again. This time, instead of doing a full scan I did the quick scan. Once the scan was complete, I again clicked on “Removed Selected” and then compared the list of the files in the log file to the file system to make sure it had deleted the items that it found.
It seemed to work just fine this time.
After some more research, I decided to install the full version with real-time scanning and we’ll see how that goes.
Malwarebyte’s Anti-Spyware did a great job helping me remove this virus without having to dig through both the filesystem and registry by hand and I would highly recommend it.
Setting Up SSH Keys to Connect from Windows to a Linux Server with Putty
The following is a how to on getting putty set up putty on a Win XP box to enable you use an RSA (or DSA) private/public key pair to connect to a linux server over SSH.
- Generate your keys on the linux server to which you want to connect.
- SSH to your server
- go to your home directory .ssh/
- Enter the following command to generate the key pair:
- # ssh-keygen -t rsa
- Enter a passphrase for your keys
This will generate two files: id_rsa and id_rsa.pub. id_rsa is the private key.
Transfer the id_rsa file to your client/local machine. Delete the id_rsa file from the server.
Use puttygen.exe to convert the private key to a format that putty.exe will like
- Fire up puttygen.exe
- Select File/Load Private Key
- Enter your passphrase that you entered when generating your key pair
- Click on the “Save Private Key” button to save a format of this private key to your local drive.
Open putty.exe
- By default putty.exe starts with the “Session” screen selected.
- Click on Connection/SSH/Auth
- Under “Private key file for authentication” click on “Browse” and select the private key that you converted in the aforementioned step.
- Go back to the Session screen, specify the IP address or name of your server and save the session.
Connect to the server:
- Run putty.exe
- Simply double-click on the saved session and it will open up an SSH session to your server and you will be prompted to enter your passkey.