Category Archives: Linux

The Linux Category actually encompasses *BSD, RH, Fedora, Ubuntu, and the like.

Ubuntu Command Line Change IP Settings

I find myself forgetting more and more when I use tools like webmin. These usually work with most flavors of linux as well.

sudo nano /etc/networking/interfaces

auto eth0
iface eth0 inet static
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255

Then restart the networking devices
sudo /etc/init.d/networking restart

*** EDIT 10/4/2017 ***
Almost a decade later and I had to update this slightly.

List Your Available Network Devices
ifconfig -a

List Your Currently Enabled/Working Network Devices
ifconfig

Edit Your Network Device
nano /etc/network/interfaces

auto ens32
iface ens32 inet static
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
dns-nameservers 192.168.3.2 192.168.3.3
dns-search domainname.local

Restart Your Network Device
ifdown ens32 && ifup ens32

*** EDIT 1/12/2018 ***
Only a few months later, but Ubuntu started using netplan instead of the usual ifup/ifconfig commands I’m used to. Now it’s yaml.
This is for 17.10 and later! Proper space is NEEDED to work.


nano /etc/netplan/01-netcfg.yaml

network:
version: 2
renderer: networkd
ethernets:
ens32:
dhcp4: no
addresses: [10.1.10.114/24,’IPV6HEREIFYOUWANT’]
gateway4: 10.1.10.1
nameservers:
search: [domain.local, otherdomain.tld]
addresses: [10.1.10.2, 10.2.10.2]

netplan apply

*** EDIT 2022-12-02 ***

Apparently this changed in Ubuntu 20.04 (although it still supported the “old way”), but in 22.04 I could not get netplan to support my use of the gateway4 option.

I’ve left the old style commented out, but the new way of using only routes for this purpose works well and opens up the idea of multiple gateways or static routes from a single system.

WordPress and Stats Pages

I have this issue from time to time – wordpress updates will break my stats pages. A simple edit in the .htaccess file clears this up.


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html).*$ [NC]
RewriteRule . - [L]

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Apt-get Not Upgrading The Kernel

If you run apt-get update and apt-get upgrade, it should upgrade most of the packages associated with your system.

However, there are certain files that will not be upgraded using these general commands.

We must run apt-get dist-upgrade instead.

***EDIT***

And this is how to upgrade from a lower version to a higher version:
apt-get install update-manager-core
do-release-upgrade

Ubuntu Disable Sounds

I always forget how to disable the “login ready” sound of the drums.

System >> Administration >> Login Window
Click on the Accessibility Tab
Uncheck the Login screen ready sound box

OR there’s the login and logoff sounds:

System >> Preferences >> Sound
Click on the Sounds Tab
Disable the Login and Logout sounds

***EDIT***
Apparently things are a little bit different in 9.10.

System > Preferences > Start Up Applications
Deselect the Gnome Login Sound

Now you will no longer hear the login noises.

Open up the terminal
sudo -u gdm gconftool-2 –-set /desktop/gnome/sound/event_sounds –-type bool false

Now you will no longer hear the startup noises.

Ubuntu 8.10 VERY Slow On HP Laptop

Not too long ago I retired my Compaq V5000 CTO Laptop in favor of a newer HP 6515b. The only thing I’m missing thus far is the long life battery I had on the V5000, but that can easily be fixed with a few $$.

I am a big fan of dual booting systems – it’s always a good idea to have a backup plan in case the first plan fails. I put Vista Enterprise SP1 x64 on my new laptop (I have to get used to Vista eventually since I do have to support the machines at work). I then waited patiently for 8.10 Ubuntu to be released.

Went to install x64 of Ubuntu – install took just over 2 hours. Odd. Then nothing is really working up to par with a 2.2GHz AMD X2. I’m sorry to say, but it’s so far been a bad experience. I figured maybe it was a 64bit issue – redownload and try to install 32bit. The installer is taking forever again, so I forgo the installer and reboot.

Then I looked on the Ubuntuforums for some answers.

Basically, the ACPI is not fully written for. ACPI is advanced configuration and power interface.
That and the APIC is not fully written for. APIC is advanced programmable interrupt controller.

I’ve been told that when you are installing Ubuntu, run it with the ACPI=OFF command, and then when it’s installed, remove the ACPI=OFF from the menu.lst and replace it with noapic.

Here’s the fix:
sudo nano /boot/grub/menu.lst
Then find where it says kernel /boot/vmlinuz-2.6.27-7-generic root=UUID=bunchoflettersandnumbers ro quiet splash
We want it to say ro quiet splash noapic

Copy Between Linux Computers

Growing up on Macintosh computers, I always feel a little crippled on my basic computer knowledge. I’m not good with DOS. I didn’t know, until recently, what an IRQ was. I had no idea how to make a bootable MS-DOS disk for ghosting. I didn’t know how to copy files between Linux systems, but I could writeup some IPchains no problem. Odd.

So anyway, here’s the command that you run on the server you’re copying FROM:
scp file_name user_name@ip_address:/directory_listing/
SCP: Secure copy
File_name: the name of the file you want to copy
User_name: name of the user with privs to the directory you’re copying to
Ip_address: IP of the server you’re copying to
Directory_listing: starts with / and doesn’t need a trailing /

In my case it’d be:
scp bigfile.iso ituser@10.1.2.2:/home/ituser

EDIT!!!!

There is also a program called WinSCP that allows you to move files back and forth with an FTP-style interface. I highly recommend it to those who use Windows.

EDIT 2 April 11, 2015
Obviously I should have included Rsync:
rsync -ru /src/dir/* root@remoteserver:/remote/dir/other/dir/

Samba Issues and Fix

After installing CentOS 5.2 x64, webmin 1.420, and vmware server 2.0.0, I tried to get samba working.

Getting samba to work correctly is the easiest via the webmin interface. Webmin actually makes almost everything easier. I like it when computers are made easier. Thank you, webmin. You can find how to install webmin by searching for webmin. Too bad I don’t get paid for the number of times I can type webmin. I’d be rich. Webmin.

Back to the task at hand… I set samba up to work:
yum install samba
But it’s not set to automatically start, so we have to use webmin ($$$) to get it to auto start. Samba requires two services to run:
1.) SMB – starts and stops the Samba smbd and nmbd daemons used to provide SMB network services.
2.) winbind – starts and stops the Samba winbind daemon.
I set both of them to startup when the system starts.

Then I set the permissions on a folder (/var/lib/virtual machines/) which I called vmware. They are/were setup correctly. But I couldn’t attach from my windows box to the samba share. Permission denied.

So then I tried to chmod -R 777 /Virtual\ Machines
Didn’t work.

As a final attempt, I tried to smbpasswd (username)
Typed in a new password
Failed to find entry for user (username)
Failed to modify password entry for user (username)

Webmin failed me! It said that it converted the users for me, but obviously it hasn’t.
So here’s the fix:

smbpassword -a (username)
New SMB password:
Retype new SMB Password
Added user (username)

And then, like magic, samba started working! Whooo!