Linux
Ubuntu Networking
The other day I went to my company’s office and tried to browse and kept getting denied on DNS lookups. Our network guru told me I needed to add a line in resolve.conf to find the nameserver.
/etc/resolve.conf
Add line:
nameserver 192.168.1.31
The problem though was that this file gets overwritten, so I had to ask him again for the setting today. Frustrated at this, I did a bit of research and it looks like if I want to make this change permanent I need to modify dhclient.conf (http://ubuntuforums.org/showthread.php?t=445753)
/etc/dhcp3/dhclient.conf
Add:
supersede domain-name "company.com"; prepend domain-name-servers 192.168.1.31;
Modifying PATH variable in Ubuntu
sudo gedit ~/.bashrc
Add this line to the file (or modify if the file already has an entry for PATH):
PATH=[your path]:”${PATH}”
Save the file
Execute to refresh the file without logging out:
source .bashrc
What to do when RSA Public Key Changes for SSH
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been changed. The fingerprint for the RSA key sent by the remote host is b4:a2:e6:d6:5b:c7:09:c2:4a:1e:99:22:82:c8:73:d6. Please contact your system administrator. Add correct host key in /root/.ssh/known_hosts to get rid of this message. Offending key in /root/.ssh/known_hosts:3 RSA host key for [host.com]:443 has changed and you have requested strict checking. Host key verification failed.
- Remove the offending line, in this case line 3.
- ssh-keygen -R hostname
Try and reconnect and it should prompt you to store the new key.
Ubuntu sound not working after suspend
I was having a problem on my Lenovo T61p in which after I suspended and woke the machine up I was getting no audio. After a bit of research, this script seems to have done the trick.
Create the file /etc/pm/sleep.d/49sound
function kill_sound_apps() {
pidsnd=$(lsof -lnP | grep /dev/snd | awk '{ print $2 }')
pidmixer=$(lsof -lnP | grep /dev/mixer | awk '{ print $2 }')
piddsp=$(lsof -lnP | grep /dev/dsp | awk '{ print $2 }')
kill $pidsnd $pidmixer $piddsp
}
case "$1" in
hibernate|suspend)
kill_sound_apps
echo `date` shut down sound for pm
;;
thaw|resume)
modprobe -r snd_hda_intel
modprobe snd_hda_intel
echo `date` starting sound coming out of pm
;;
*)
;;
esac
exit $?
chmod the file as root ‘chmod 755 /etc/pm/sleep.d/49sound’.
kill_sound_apps() {
pidsnd=$(lsof -lnP | grep /dev/snd | awk '{ print $2 }')
pidmixer=$(lsof -lnP | grep /dev/mixer | awk '{ print $2 }')
piddsp=$(lsof -lnP | grep /dev/dsp | awk '{ print $2 }')
kill $pidsnd $pidmixer $piddsp
}
ImageMagick
I was trying to upload images to WordPress today and hit the php max upload size per image since my new camera is 12MP. Rather than increase the upload size and wait forever to send my pics up, I decided to look for a nice Linux tool for image resizing. Low and behold I have one installed, ImageMagick. I’ve never used this tool before, but some quick investigation tells me that there are APIs for all the popular programming languages plus a command line interface. I know it’s been around for a while, but it’s new to me and it dominates. I’m going to use this post to keep track of common commands I use with this program and how I’ve used the APIs, if it ever gets to that.
convert IMG_0666.JPG -resize 50% OrthoMax.jpg
