Archive for the ‘linux’ Category
I had a situation where we had an old Bugzilla server that hadn’t been used for several years. As these things often happen, the “powers that be” suddenly decided we need that server to be back up and running NOW. Of course, nobody could remember their passwords any more and the email password mechanism had stopped working.
A Google search could only seem to turn up suggestions that started with “login to an admin user…”. Yeah, if I could do that I wouldn’t really have problem would I?
Anyway the solution was fairly easy actually.
NOTE: this is a dangerous solution that leaves the admin user exposed for a little while. Take reasonable precautions to prevent access until finished. Either with firewall rules or via an Apache .htaccess rule.
- Sign on to Mysql via the command line on the server in question
USE bugs; (the bugzilla database)
UPDATE profiles SET cryptpassword=null WHERE userid=1;
- You can now login as that user with no password (see I told you it was dangerous).
- As admin you can change the password of another user to a password that you can remember, so do that.
- Now, if you go back into the database and list the profiles table you will see the encrypted passwords so locate the user who’s password you know.
- Now just replace the password string for your admin user with the encrypted string from the user you just looked up in the above SQL statement (as below).
userid is the id of an admin user
SELECT * FROM profiles;
UPDATE profiles SET cryptpassword="23WHATEVER56" WHERE userid=1;
Once you have set the encrypted password you should be able to login as the admin user using the password you set and you can change the password at this point to a more complicated one.
I believe that newer versions of Bugzilla have eliminated the need for the above steps with a change passwords switch in the checksetup.pl program on the commandline.
Ask any Linux geek which is the best Window Manager and you can easily find yourself in the middle of a holy war but ask a Windows user the same question and you will be met with a blank stare. Window Managers are one of those wild and wonderful features of Linux that can completely change your experience with your computer.
To either change you Window Manager (in Ubuntu) or even to just see which one is currently the default you need to look at the file:
It would show for GNOME:
and for KDE:
There are a wide variety of other possibilities of course but those are the two big ones.
To change the Window Manager open a terminal and type:
sudo dpkg-reconfigure gdm
NOTE: the WM configuration files are different for other Linux distributions and yes, I agree, that should be standardized.
Switching between using Firefox in Windows and Ubuntu I am used to being able to hit the BACKSPACE key to go back one page. This is the default behaviour in Windows but not in Ubuntu.
To change the behaviour in Ubuntu:
Type about:config as your URL
Filter to browser.backspace_action and then change that value.
0 – sets it to the windows default (back 1 page)
1 – sets it to scroll up (shift+backspace = scroll down)
2 – disable backspace key
Incidentally in Ubuntu you can always do the following without changing anything:
- ALT+ Left Arrow = go back 1 page
- ALT+ Right Arrow = go fwd 1 page
Some commands that come in handy for software RAID arrays.
To find out what your RAID array is doing issue:
To find out the status of a particular device:
mdadm –detail /dev/mdx
To remove a drive from the array:
mdadm -r /dev/md0 /dev/sdc1
(this will remove partition sdc1 from the md0 array)
To add a drive back in to an array:
mdadm /dev/md0 -a /dev/sdc1
(this will add partition sdc1 in to the md0 array)
To watch an array as it rebuilds itself:
watch -n1 cat /proc/mdstat
The different levels of RAID are:
A “striped” mode. Ideally the devices are the same size. There is no redundancy but you do gain performance (from parallel reads or writes). If you lose a drive you will lose data.
A mirrored RAID set. All data is written to all drives at once. You can lose a drive and not lose data. Write performance will be a little worse because you must wait until all data on all drives is finished. It is possible to saturate the PCI bus while writing and this causes the biggest bottleneck (hardware RAID suffers less from this). Read performance can be better than a single drive. It is also possible to have a spare dive kick in immediately in the event of a drive failure. RAID size is limited by the smallest disk available.
Requires 3 or more drives. It is essentially a RAID-0 array with an additional drive being used to store parity informaton so that a failed drive can be reconstructed. The parity drive becomes the performance bottleneck. In addition if the parity drive fails then redundancy is also lost.
Requires 3 or more drives. This is a very useful option as it combines the performance advantages of a RAID-0 array with the redundancy of RAID-1. In this case parity information is distributed across all drives. RAID-5 arrays can lose one drive but not two. Actual performance gains will depend on usage scenarios with heavilly fragmented data fairing not very well.
Setting up a RAID array on Linux is fairly easy and is definitely effective. I have even set this up on servers that have hardware RAID equipment because the hardware drivers were either flaky or not available.
Be aware that software RAID will steal some CPU cycles. I feel that most modern hardware has more than enough power to spare but, if you need every ounce of performance then hardware RAID is definitely the way to go. I can say that I haven’t noticed much of a performance hit with RAID running and the benefit has always been worth it but, as they say, your mileage may vary.
This is most easilly accomplished with a recent kernel (at least 2.4 but that covers almost all recent distros). The RAID tools are also usually installed as is mdadm.
For a few months now I have tried to track down the source of error messages in my Samba logs.
The server was functioning correctly but, I kept getting messages about “unable to become connected user..”.
Well I finally solved it and the solution was actually very simple. The first thing I did was when I got few moments to have a good look at the server I changed the log level to 2 in smb.conf.
From that I was able to determine that the error was related to the Windows share IPC$. This share is really just for Windows internal use related to browsing and is not actually used for any sharing of files.
I tried adding various versions of the IPC$ share to see if that helped and what finally worked was to just add a bare bones IPC$ share as below:
- path = /home/tmp
- hosts allow = 192.168.1.0/24 127.0.0.1
- hosts deny = 0.0.0.0
…and that’s it .
Seperate subnets with a space.
0.0.0.0 is Samba shorthand for all.
Okay its seems that the Virtualmin downgrade has settled down now.
I’m still working out exactly how much functionality I have lost by going to the free GPL version but this is what I did:
- I downloaded the repo rpm and installed it with:
rpm -Uvh –oldpackage virtualmin-release-latest.rpm
- I then ran a
yum clean all
This will clean up the repo settings left over from the downgrade and reset to the gpl version.
I then went into the webmin control panel:
WEBMIN>SYSTEM>Scheduled Cron Jobs
and disabled the following cron jobs (these are apparently not valid in the gpl version of Virtualmin):
That last one is a clean up program for fastcgi but , I haven’t found out what the other 2 jobs do.
I just know that they give me errors in my logs if left enabled.
I have since discovered that it might be possible to change the username and password to “GPL” and the re-run the install script. I have not tested this and don’t know what that would do to the existing servers, mailpacks , etc.
Okay so it turns out the upgrade (downgrade..sidegrade???) to Virtualmin didn’t work as well as I had hoped.
I did the steps outlined previously but some problems cropped up.
- Some hourly cron jobs started to act up (most notably one which cleans up Fastcgi scripts …fcgiclean.pl)
- The Virtualmin Control Panel announced a new update which , when applied, actually reverted back to the Pro version and then proceeded to warn me that the license was out of date …again…sigh
I will troll the support forums and see if I can fix this.
Also unfortunately Virtualmin seems to be updating their website so their support documentation is full of stale links…double sigh.
I will keep posting here.
I recently had to downgrade our Virtualmin package from PRO to GPL because our license expired and we didn’t seem to need the features of the PRO version any more.
Time will tell if this turns out to be a foolish move but this is what I did.
Basically you just install the GPL version over top of the PRO version, how you downgrade depends on your OS. For an RPM-based Distro like Centos 5, you’ll have to use the “–old-package” option to RPM to install the GPL version. Because upgrading is the far more common scenario, PRO has a higher Epoch than GPL, which means it always looks like a newer version to rpm/yum, even if it actually isn’t.
The GPL repository will have the same URL as the Professional one, except it
has “/gpl/” in the path.
Steps I took:
First install the GPL version over the PRO version;
rpm -Uvh –oldpackage wbm-virtual-server-”VERS#”.noarch.rpm
Obviously, with GPL, you won’t need a serial number to download it.
Then upgrade the repo with:
rpm -Uvh –oldpackage http://software.virtualmin.com/gpl/
Then do a
…and finally REBOOT if a new kernel was installed.