Automatic "zombie" processes killing (shell script)

Here is a shell script example that can be run by cron for automatic killing of “zombie” processes in Linux system: zombies.sh

Read more →

 

Quick shell change for user in Unix or Linux

In order to change shell for a particular user of Unix/Linux system without editing /etc/passwd file manually just use command: chsh -s /path/to/shell username for example, to change shell to ‘sh’ from ‘bash’ for user ‘viper’, use command: chsh -s /bin/sh viper

Read more →

 

Encryption files with GPG without user intervention (batch)

I usually encrypt files with GPG with symmetric algorithms when I have to transmit files over insecure channel: for example I encrypt backup files stored at my USB stick and I’m sure that if it’s stolen or lost my files are in safety. Encryption without user intervention can be used when you wish to perform automatic (runs with cron) backup procedure and protect backup files. To encrypt file /tmp/file.tgz by [...]

Read more →

 

FAQ: Change forgotten or lost MySQL root password

Question: I forgot root password for MySQL DBE. How to reset or recover it? PLEASE HELP! Answer: Below is simple algorithm to reset MySQL root password in Linux, FreeBSD, OpenBSD and other Unix like operating systems: 1. Stop MySQL server process by one of the following commands: # /etc/init.d/mysqld stop # killall -9 mysqld # kill `cat /mysql-data-directory/host_name.pid` # mysqladmin shutdown To check if mysqld is killed run “ps ax [...]

Read more →

 

Secure shell (ssh) connection without password

Let’s assume we have two Linux running machines, one of them is ‘client’ and other is ‘server’. Task lies in allowing client to access server via ssh securely without a need to type password by hands. It’s usually useful to perform some operations that are to be done without user intervention (for example copying backup data files from client to server through ‘scp’).First of all it’s necessary to make sure [...]

Read more →