Posts

Showing posts with the label Linux

FTP: VSFTPD 550 Permission Denied Error

 Issue:  The VSFTP Server by default doesn't allow to write data to the server. To allow this need to change the configuration on the server.  ftp> put file1.txt local: file1.txt remote: file1.txt 200 PORT command successful. Consider using PASV. 550 Permission denied. ftp> Mitigation: Edit vsftpd.conf file  $ sudo vi /etc/vsftpd.conf uncomment the line "write_enable=YES" write_enable=YES Restart the service to effect the configuration change.  $ sudo service vsftpd restart Now you should able to write to the vsftpd server.

How To Create A Bash Install Script/.bin installer

Have you ever wanted to create an installer program on a Linux system, but didn’t want all the hassle of an actual install builder? I have. I recently had need of a simple, no frills installation that could: ask the user a few questions extract some binary files and do some stuff with those binary files. So I’m going to show you how you can create such an installer with very little hassle. I can’t actually claim credit for this method though; I actually got the idea from Sun’s JDK installer for the Linux platform. You download a “.bin” file, change the file mode so that it is executable and then run it. It displays the end user license agreement, gets some feedback and then goes about installing Java for you. Well, if you open that .bin file up in a text editor (say vi) you’ll see that it’s nothing more than a shell script with a binary chunked onto the end. Thus my plans for world domination were born… The Script The first part of this process is to create you...

Recovery Mysql root password.

You can recover MySQL database server password with following five easy steps. Step # 1: Stop the MySQL server process. Step # 2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for password Step # 3: Connect to mysql server as the root user Step # 4: Setup new root password Step # 5: Exit and restart MySQL server Here are commands you need to type for each step (login as the root user): Step # 1 : Stop mysql service # /etc/init.d/mysql stop Output: Stopping MySQL database server: mysqld. Step # 2: Start to MySQL server w/o password: # mysqld_safe --skip-grant-tables & Output: [1] 5988 Starting mysqld daemon with databases from /var/lib/mysql mysqld_safe[6025]: started Step # 3: Connect to mysql server using mysql client: # mysql -u root Output: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log Type 'help;' or '\h' for help. Ty...

hOW tO eNCRYPT aND dECRYPT fILES wITH a pASSWORD

To encrypt and decrypt files with a password, use gpg command. It is an encryption and signing tool for Linux/UNIX like operating system such as FreeBSD/Solaris. GnuPG stands for GNU Privacy Guard and is GNU's tool for secure communication and data storage. It can be used to encrypt data and to create digital signatures. It includes an advanced key management facility. Encrypting a file in linux To encrypt single file, use command gpg as follows: $ gpg -c filename To encrypt myfinancial.info file, type the command: $ gpg -c myfinancial.info Output: Enter passphrase: Repeat passphrase: This will create a myfinancial.info.gpg file. Option: * -c : Encrypt with symmetric cipher. Caution if you ever forgot your password aka passphrase, you cannot recover the data as it use very strong encryption. Task: decrypt file To decrypt file use gpg command: $ gpg myfinancial.info.gpg Output: gpg myfinancial.info.gpg gpg: CAST5 encrypted data Enter passphrase: Decrypt file and write output...

LINUX or UNIX PASSWORD PROTECT FILES

Linux and other Unixish oses offers strong file permissions and ACL (access control list) concept in Linux/UNIX computer security used to enforce privilege separation. However, none of them offers a password to protect files. You can use GNU gpg (GNU Privacy Guard) encryption and signing tool. It is a suite of cryptographic software. Many new UNIX/Linux users get confused with this fact. Solution is to use following commands to encrypt or decrypt files with a password. * Use GNU gpg command * Use mcrypt command * Use openssl command mcrypt command Mcrypt is a simple crypting program, a replacement for the old unix crypt. When encrypting or decrypting a file, a new file is created with the extension .nc and mode 0600. The new file keeps the modification date of the original. The original file may be deleted by specifying the -u parameter. Examples Encrypt data.txt file: $ mcrypt data.txt Output: Enter the passphrase (maximum of 512 characters) Please use a combination...

uNIX sEMAPHORES aND sHARED mEMORY eXPLAINED

Unix Semaphores and Shared Memory Explained =========================================== General ======= Shared memory is exactly that - a memory region that can shared between different processes. Oracle uses shared memory for implementing the SGA, which needs to be visible to all database sessions. Shared memory is also used in the implementation of the SQL*Net V1 Fast driver as a means of communicating between the application and shadow process. On the RS/6000, each shadow process stores its PGA in a shared memory segment (however, only the shadow attaches this segment). In the latter two cases, Oracle allocates the shared memory dynamically as opposed to the allocation of the SGA, which occurs at instance startup. This allocation will not be discussed in this paper. Semaphores can be thought of as flags (hence their name, semaphores). They are either on or off. A process can turn on the flag or ...

OpenSource backup Solution: Amanda Netbackup

Amanda is the Advanced Maryland Automatic Network Disk Archiver, developed at the University of Maryland in the 1990s. While it is now maintained at SourceForge and support is provided only through mailing lists and a FAQ-O-MATIC, it is still a highly useful, stable network backup utility with a wide range of features. Amanda is tailored for networks that have a central server with a high-capacity tape drive and multiple backup clients. Although Amanda was built for UNIX systems, it has been extended to provide backup services to Windows clients (via Samba, although a separate project is underway to develop a native Windows client) to allow deployment in heterogeneous environments. Architecture Amanda is a client-server application where the server pulls backups from individual clients according to specifications defined in a named configuration. Amanda can pull multiple streams from different clients at the same time, writing each stream to a file on a designated “holding...

SOLARIES: SOME OF THE USE FULL UTILITIES

Solaris Command Reference HD info(vendor, RPM, capacity) oasis:/home/tse/dxy[9:18pm] iostat -E sd0 Soft Errors: 0 Hard Errors: 3 Transport Errors: 0 Vendor: SEAGATE Product: ST34371W SUN4.2G Revision: 7462 Serial No: 9742K71685 RPM: 7200 Heads: 16 Size: 4.29GB <4292075520 bytes> Media Error: 0 Device Not Ready: 0 No Device: 3 Recoverable: 0 Illegal Request: 0 Predictive Failure Analysis: 0 sd1 Soft Errors: 0 Hard Errors: 3 Transport Errors: 0 Vendor: SEAGATE Product: ST32171W SUN2.1G Revision: 7462 Serial No: 9736T74649 RPM: 5400 Heads: 19 Size: 2.13GB <2127708160 bytes> Media Error: 0 Device Not Ready: 0 No Device: 3 Recoverable: 0 Illegal Request: 0 Predictive Failure Analysis: 0 sd6 Soft Errors: 0 Hard Errors: 3 Transport Errors: 0 Vendor: TOSHIBA Product: XM5701TASUN12XCD Revision: 0997 Serial No: 04/09/97 RPM: 0 Heads: 0 Size: 18446744073.71GB <-8589934591 bytes> Media Error: 0 Device Not Ready: 3 No Device: 0 Recoverable: 0 Illegal Request: 0 Pred...

LPR Issue after installing Dell Driver for Printer

The following Example has been given on the installation of the Dell Driver for the Printer Type DELL LASER MFP 1815DN. Follow the following steps to install the Dell Driver for Printer. 1.Download the Driver from the following URL:- http://support.dell.com/support/downloa ... tid=&impid 2. Untar with the following command:- #tar xvzf Dell1815dn_Linux_DriverA02.tar.gz 3. Enter to the extracted Directory. #cd cdroot 4. Run the following binary file. (it should be run in GUI Env) #./autorun 5. The above run will install the Dell driver.. 6. You will find the newly installed drivers and binaries in the following location. /opt/DELL/mfp 7. The most important configuration changed from the above installation from the default one is as follow:- The Default lpr binary location and link #which lpr /usr/bin/lpr #ls -d /usr/bin/lpr lrwxrwxrwx 1 root root 23 Dec 23 21:38 lpr -> /etc/alternatives/print #ls -ld /etc/alternatives/print lrwxrwxrwx 1 root root 17 May 20 2007 /etc/alternat...

How to pass password as text to the 'passwd' command?

'passwd' command is used to change the user password on Linux. As a SysAdmin you may need to change/reset the user password on multiple servers in a network. As a root user you could use the 'passwd' command over ssh to do so. Generally the passwd command need new password to be supplied twice, but using --stdin option you can change the password providing new password on command line. This will also help to reduce the typo errors during changing the password. The example command: #echo 'newpass' | passwd --stdin user1 where : newpass is new password to be set for user user1. Note: --stdin option can be used only by ROOT user

Find a string in all files of the system

find / -type f -print0 | xargs -0 grep -i "string"

How to Bounce Emails in Qmail for Non Existing Accounts.

Type the following in the /home/vpopmail/domian/.qmail-default | /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox

Growing the devices in a Software RAID array

Growing the devices in a Software RAID array As hard disk space is ever increasing, you may get replacement drives that are significantly larger than the original devices that they replace, so this tip will show how to increase the size of a RAID array using larger partitions to replace smaller partitions in the original RAID array. We will assume that you have a RAID 5 array using three partitions (/dev/sdb1, /dev/sdc1, and /dev/sdd1) on /dev/md0. These partitions are 1 GiB each, giving you about 2 GiB of usable space. You add new disks and create three partitions (/dev/sde1, /dev/sdf1, and /dev/sdg1) of 5 GiB in size. By the end, you should have about 10 GiB of usable space. After you have created the partitions and set the partitions type to 0xfd, you can add these devices to the array. They will become hot spares: mdadm /dev/md0 -a /dev/sde1 /dev/sdf1 /dev/sdg1 Fail the original devices one at a time, ensuring that the array rebuilds after each failed device. DO NOT f...

How to configure Netdump on Linux?

What is Netdump? Unlike traditional crash dump facilities, this facility dumps memory images to a centralized server via the network. The goal of a crash dump facility is to provide fault analysis, particularly exhaustive first fault analysis (first fault analysis is when a bug can be corrected without requiring reproducing the bug), in the case of software or hardware bugs that manifest as system crashes (in Linux parlance, Oops, BUG(), or panic). Linux has traditionally provided an abbreviated signature of a crash which includes the processor state (on the processor that registered the crash), a stack trace, and a limited instruction trace. The utility of these signatures has been proved over the years; they nearly always provide all the information that is required to debug a fault, even at first fault. The network console functionality provides the ability to log all kernel messages, including Linux crash signature messages, to a network syslog server. This has very lo...

Unload qlogic modules

The qlogic modules are not able to unload "rmmod", says bussy. Below are the dependencies that need to be cleared before attampt to unload qlaxxx modules. 1. Stop SAN-Surfer GUI/CLI if running. 2. Stop qlogic SAN-Serfer agent service if running. # service iqlremote stop >>>>>> for iSCSI # service qlremote stop >>>>>> for FC 3. Check whether qlogic IOCTL module is loaded rmmod qisioctl 4. Check and kill if any process running for qlogic. #ps -ef | grep qla Before killing the process be 100% confirm that the process belongs to qlogic. i.e. qla4xxx_3_dpc qla4xxx_2_dpc.

Creating RAW devices on RHEL5.

The rawdevices service and /etc/sysconfig/rawdevices file no longer exist in RHEL5 and raw devices are now configured via udev rules. Creating the raw devices: Nevertheless, to create raw devices, add entries to /etc/udev/rules.d/60-raw.rules in the following formats: Quote: ACTION=="add", KERNEL==" ", RUN+="raw /dev/raw/rawX %N" If using unpartitioned LUNs: Quote: ACTION=="add", KERNEL=="sd*[!0-9]", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="3600601601bd2180072193a9242c3dc11", RUN+="/bin/raw /dev/raw/raw1 %N" If using partitioned LUNs: Quote: ACTION=="add", KERNEL=="sd*[0-9]", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="3600601601bd2180072193a9242c3dc11", RUN+="/bin/raw /dev/raw/raw%n %N" Setting ownership and permissions on the raw devices: Quote: ACTION=="add", KERNEL=="raw*", OWNER=="root", GROUP=="disk...

Verify RPM and its Attributes

When verifying a package, RPM produces output only if there is a verification failure. When a file fails verification, the format of the output is a bit cryptic, but it packs all the information you need into one line per file. Here is the format: SM5DLUGT c Where: S is the file size. M is the file's mode. 5 is the MD5 checksum of the file. D is the file's major and minor numbers. L is the file's symbolic link contents. U is owner of the file. G is the file's group. T is the modification time of the file. c appears only if the file is a configuration file. This is handy for quickly identifying config files, as they are very likely to change, and therefore, very unlikely to verify successfully. is the file that failed verification. The complete path is listed to make it easy to find. It's unlikely that every file attribute will fail to verify, so each of the eight attribute flags will only appear if there is a problem...

Stop SNMP Connection and Transport Socket Log

Stop SNMP Connection and Transport Socket Log in /var/log/messages. The following logs always fills the /var/log/messages and makes difficult to identify the other System and OS related logs. And it always logs in two places in /var/log/messages and /var/log/snmpd.log respectively. Connection from - 192.168.177.35 transport socket = 14 With two ways we can stop the log to go to /var/log/messages and loging in only to one place /var/log/snmpd.log. Procedure 1 Step1. view the service script /etc/init.d/snmpd if you find the following lines if [ -e /etc/sysconfig/snmpd.options ]; then . /etc/sysconfig/snmpd.options else OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a" fi Step 2. Create a file /etc/sysconfig/snmpd.options #touch /etc/sysconfig/snmpd.options Step 3. Insert the following in the above created file. OPTIONS="-LS e d -Lf /dev/null -p /var/run/snmpd.pid -a" Step 4. Restart t...

Making the cpan shell to use http mirrors instead of ftp

Image
In some network ftp port is blocked.This prevents the installation on cpan modules as cpan uses ftp mirrors by default. This Procedure makes the perl shell to use http mirrors for installation of perl modules. *************************************************************************************************************************************************** Go to perl cpamn shell: #perl -MCPAN -e shell Get the list of the current urls that cpan shell uses to get modules. cpan> o conf urllist urllist 0 [ftp://cpan.modperl.cn/] Type 'o conf' to view all configuration items Add http url, url list is available @http://www.cpan.org/SITES.html. cpan> o conf urllist push http://cpan.modperl.cn Check if the new URL is added: cpan> o conf urllist Save the changes: cpan> o conf commit cpan> exit ***********************************************************************************************************************************************...

Multiple bond devices on single server..

Problem You want to set up more than one bonded interface on your Red Hat Enterprise Linux 4 or 5 system. Solution Multiple bonding setup is different for Red Hat Enterprise Linux 4 and Red Hat Enterprise Linux 5. For Red Hat Enterprise Linux 5: Because initscripts package is updated to fix several problem about bonding, if you are using Red Hat Enterprise Linux 5.3 (or update to initscripts-8.45.25-1.el5), configure multiple bonding channels is very similar to configure single bonding channel. You can setup the ifcfg-bondN and ifcfg-ethX files as if there were only one bonding channel. You can specify different BONDING_OPTS for different bonding channels so that they can have different mode and other settings. Refer to the Red Hat Enterprise Linux 5 Deployment Guide "14.2.3. Channel Bonding Interfaces" for more information. For example, you can add the following line to /etc/modprobe.conf: alias bond0 bonding alias bond1 bonding And here is an example for ifcfg-bond...