Skip to main content

Posts

Showing posts from 2012

Mount a encrypt hard disk in CentOS 6.3

 Encrypt Hard Disk mount in Linux System (CentOS 6.3)
Attach the hard disk to the linux system
check the name of the attached hard disk

#ls /dev/sd*
/dev/sda   /dev/sda1 /dev/sdb  /dev/sdb1

choose you encrypt volume and give a name to encrypt partition
# cryptsetup -v luksOpen /dev/sdb1 mydisk
Enter passphrase for /dev/sdg2:
Key slot 0 unlocked.
Command successful.


check the name exist in the path
 #ls /dev/mapper/

mount the named hard disk
# mount /dev/mapper/mydisk /mnt

check mount partition
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_localhost-lv_root
                       50G  6.7G   41G  15% /
tmpfs                  24G     0   24G   0% /dev/shm
/dev/sda1             485M   64M  396M  14% /boot
/dev/mapper/vg_localhost-lv_home
                      1.0T  654G  319G  68% /home
/dev/mapper/mydisk   591G  236G  326G  42% /mnt


umount the encrypt disk
# umount /mnt
# cryptsetup -v luksClose /dev/mapper/mydisk
Command successful.



Logwatch for System Log Mail report in Linux

Logwatch for System Log Mail report in Linux I look for setup the logwatch for email report of the system log files. I can't login the system every time but need to look the system log files for monitoring purpose for system. It tell me the status of the system health, error & problems.
But an issue come when i have to replace my sendmail with other mail server then the logwatch is not able to send the mail. After a long time search i find the solution by giving the full path for sendmail in logwatch.conf. After that the logwatch started the sending mails.
edit the logwatch.conf for the line mailer = "/usr/sbin/sendmail -t"

Time Stamp in History of Linux

Time Stamp in History of Linux I look an issue regarding the command execution at which time then i look for the time stamp in history and found that it is very easy and you can enable for all users in the system. Here is the solution for it in CentOS Linux.
create a file with following lines:-
#vim /etc/profile.d/timestamp-history.sh #cat /etc/profile.d/timestamp-history.sh
##this is the history parameters addition by rakesh for history timestamp
HISTSIZE=1000
HISTFILESIZE=800000
HISTTIMEFORMAT="[%F %T %Z] "
export HISTSIZE HISTFILESIZE HISTTIMEFORMAT

Now save this file and open the terminal to see the effect of this # history  1005  [2012-09-08 12:14:59 IST] history
 1006  [2012-09-08 12:23:01 IST] exit
 1007  [2012-09-08 12:42:06 IST] history
 1008  [2012-09-08 12:42:53 IST] cat /etc/profile.d/timestamp-history.sh
 1009  [2012-09-08 12:45:15 IST] history

its very easy and you can read more from the other sources about it.

Find a service with path using port in Linux

Find a service with path using port in Linux i face a problem where i need to know that the given port is used by which service and where is the path of the service.
So for the solution of this problem is that:- 1. you must know which port ?     use: netstat -atn 2. then find the pid that using the port?     use: fuser <port number>/tcp or udp 3. after getting pid you find the service name & path     use: ps -ef |grep <pid>
for example:- # netstat -atn # fuser 5989/tcp
# sudo fuser 5989/tcp
#  ps -ef |grep 7842

Linux Signal Basics

Linux Signal
This topic i choose for reading purpose because if you need to know reason then you must know the application and its signal in the Operation System.
First the signals described in the original POSIX.1 standard. SignalValueActionComment


or death of controlling processSIGINT2TermInterrupt from keyboardSIGQUIT3CoreQuit from keyboardSIGILL4CoreIllegal InstructionSIGABRT6CoreAbort signal fromabortSIGFPE8CoreFloating point exceptionSIGKILL9TermKill signalSIGSEGV11CoreInvalid memory referenceSIGPIPE13TermBroken pipe: write to pipe with no readersSIGALRM14TermTimer signal fromalarmSIGTERM15TermTermination signalSIGUSR130,10,16TermUser-defined signal 1SIGUSR231,12,17TermUser-defined signal 2SIGCHLD20,17,18IgnChild stopped or terminatedSIGCONT19,18,25
Continue if stoppedSIGSTOP17,19,23StopStop processSIGTSTP18,20,24StopStop typed at ttySIGTTIN21,21,26Stoptty input for background processSIGTTOU22,22,27Stoptty output for background process The signalsSIGKILLandSIGSTOPcannot be caught, …

Mount Encrypted EXT4 Filesystem using Linux Command in CentOS

Mount Encrypted EXT4 Filesystem using Linux Command in CentOS6.3
I wish to mount my Encrypted HDD in CentOS6.3 in command line because i have no GUI interface in the system. Now the problem come that it was not simply mount in the linux system. So i look the procedure and given as
Look the drive for the encryption # cryptsetup -v luksOpen /dev/<drive name like sdb2>
Now open the filesystem using encryption # cryptsetup -v luksOpen /dev/<drive name like sdb2> <mount foldername> it will ask the encryption password,enter the password
Now it will create a location that can be mount on the given folder name #mount -t ext4 /dev/mapper/<mount foldername>  < location of mount foldername>
Remove the encrypted Filesystem # umount  < location of mount foldername> #cryptsetup -v luksClose /dev/mapper/<mount foldername>
what i have done as follows #cryptsetup -v luksDump /dev/sdc2 #cryptsetup -v luksOpen /dev/sdc2 /mnt/ #mount -t ext4 /dev/mapper/mnt …

Google Talk using Pidgin in CentOS6

 Follow it in the Pidgin for google talk First, open your Google Talk account preference. Head to "Basic" tab and write "gmail.com" in "Domain" field. Make sure the protocol is XMPP.Switch to Advanced tab. Select "Force old (port 5223) SSL"Make sure the following fields are changes in this way:Connect port: 443Connect Server: talk.google.com
 For MSN hotmail settings, just follow given below:-
 Use HTTP Method: Checked
now save this settings and start using chat.

Remote Desktop like Windows in Linux

We have many times configure the vncserver but never think about that the configure the Remote Desktop in Linux so that the Linux user can access the Linux server using even windows machine.



just few step can make this possible
Enable epel repository in Linux then :-
yum install xrdpservice xrdp startadd lines in  /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3389 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 3389 -j ACCEPTservice iptables restart Now you can access your machine using remote desktop client either from windows command mstsc or using Linux command tsclient


AMD Graphic Driver (Radeon 6400 series) Install on Linux CentOS-6.2 x86_64 bit Troubleshoot

AMD Graphic Driver (Radeon 6400 series) Troubleshoot
i have faced a problem with this graphic card. whenever i update my kernel version in the CentOS-6_x86_64 then the graphic is not supported by the card and hang the system in command line and not give the further response to work. The reason is the driver of the graphic card is work with kernel and whenever the kernel updated then the graphic driver is not combined with it. So the solution is following for get back the Graphic:
you can stick to kernel version on which you have install graphic driver.you can update the kernel and after that boot it in command line and install the graphic driver again on updated kernel. I have done it three time when i updated my kernel.

you can do it in this way:-

1. choose the single mode with updated kernel and get the command line.
then install the driver again and reboot the system.
2. you can also do this by another way. In old kernel mode, first edit the file /etc/inittab for command line mode t…

Command Comparison between DOS & Linux/Unix

Command Comparison:

DOS CommandUNIX or Bash CommandActionDIRls -l (or use ls -lF)(-a all files)
(df -k Space remaining on filesystem)List directory contentsDIR *.* /o-d
DIR *.* /v /os
DIR /s
DIR /aals -tr
ls -ls
ls -R
ls -aList directory contents by reverse time of modification/creation.
List files and size
List directory/sub-directory contents recursively.
List hidden files.TREEls -RList directory recursivlyCDcdChange directoryMKDIR
MDmkdirMake a new directoryASSIGNlnCreate a file or directory linkRMDIR
RDrmdirRemove a directoryCHDIRpwdDisplay directory locationDEL
ERASErm -ivRemove a fileRMDIR /S (NT)
DELTREE (Win 95...)rm -RRemove all directories and files below given directoryCOPYcp -pivCopy a fileXCOPYcp -RCopy all file of directory recursivlyRENAME or MOVEmv -ivRename/move a fileTYPEcatDump contents of a file to users screenMOREmorePipe output a single page at a timeHELP or COMMAND /?manOnline manualsCLSclear
ctrl-lClear screenEXIT

Create users by command

Create users by command
I have create users by command line and assign a group wheel and uid if required. You can read the man page for useradd #man useradd example is given below:
1: simple add user with password [root@study ~]# useradd ashish -pashish123
[root@study ~]# id ashish
uid=501(ashish) gid=501(ashish) groups=501(ashish)
2: add user with additional group "wheel" [root@study ~]# useradd sandeep -psandeep123 -Gwheel
[root@study ~]# id sandeep
uid=503(sandeep) gid=503(sandeep) groups=503(sandeep),10(wheel)
3: add user with additional group and specific uid=502
[root@study ~]# useradd dilip -pdilip123 -Gwheel -u502
[root@study ~]# id dilip
uid=502(dilip) gid=502(dilip) groups=502(dilip),10(wheel)

NTFS filesystem problem in Linux System

NTFS  filesystem problem in Linux System

The ntfs filesystem found in the windows system & ext4 is found in latest version of linux system.

The one problem i faced while using the ntfs filesystem is that it doesn't preserve the attributes of the file that may be a problem for the advanced users.
Some time we require to keep the attribute of the files like user,time,permission etc.

The given drive support the ntfs filesystem in the linux
fuse-ntfs-3g
2:ntfs-3g-2011.4.12-5.el6.x86_64

i use both for testing.


[root@linux-system ~]$ df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/sdb1  fuseblk   347582460    501608 347080852   1% /media/My Passport

[root@linux-system lab-test]# echo test > word.txt
[root@linux-system lab-test]# echo test > /media/My\ Passport/text-files/word.txt

[root@linux-system lab-test]# ll --full-time word.txt /media/My\ Passport/text-files/word.txt
-rwxrwxrwx 1 user user 5 2012-07-13 14:11:53.538205000 +0530 /media/My Passport/…

Login ssh server without password

SSH Login Without Password Using ssh-keygen & ssh-copy-id Step 1: Create public and private keys using ssh-key-gen on local-host$ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
/home/user/.ssh/id_rsa already exists.
Overwrite (y/n)? n
 exit if already present Step 2: Copy the public key to remote-host using ssh-copy-id$ ssh-copy-id -i ~/.ssh/id_rsa.pub sys1
rakesh@sys1's password:
$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@sys1
root@sys1's password:
Now try logging into the machine, with "ssh 'root@sys1'", and check in:
  .ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting. Step 3: Login to remote-host without entering the password $ ssh root@sys1
Last login: Fri Jun 29 06:20:08 2012 from 192.168.122.1 Now this is the only three steps you required to do it on terminal for enable the ssh login with key

Linux Bash History: Display Date And Time For Each Command

Linux Bash History: Display Date And Time For Each Command of a given userJust copy and paste this command and then enter for enable the bash history with date and time for a given user account of linux. $ echo 'export HISTTIMEFORMAT="%d/%m/%y %T"' >> ~/.bash_profile
sample output :-$ history |tail
  789  28/06/12 10:12:46 history
  790  28/06/12 10:13:16  echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile
  791  28/06/12 10:13:25 cat  ~/.bash_profile
  792  28/06/12 10:21:14 clear
  793  28/06/12 10:21:18 history
  794  28/06/12 10:21:21 clear
  795  28/06/12 10:21:28 history |less
  796  28/06/12 10:21:34 history |head
  797  28/06/12 10:21:36 clear
  798  28/06/12 10:21:40 history |tail

Convert output file to other formats

Convert output file to other formatsfor video file format $ ffmpeg -i ~/out.ogv ~/Desktop/SL_tutorial.flvfor image file format$ convert rose.jpg rose.png$ convert rose.jpg -resize 50% rose.png$ convert -size 320x85 canvas:none -font Bookman-DemiItalic -pointsize 72 \ -draw "text 25,60 'Magick'" -channel RGBA -blur 0x6 -fill darkred -stroke magenta \ -draw "text 20,55 'Magick'" fuzzy-magick.png

AMD Graphic Driver (Radeon 6400 series) Install on Linux CentOS-6.2 x86_64 bit

Add-on in Dell vostro 3350 laptop for AMD Catalyst™
driver Radeon HD 6400 series graphic card in CentOS 6.2 x86_64 Linux
Step1: Update the CentOS with following packages
# yum install kernel-devel kernel-headers gcc gcc-c++

Now download the driver from the amd site http://support.amd.com/us/gpudownload/linux/Pages/radeon_linux.aspx

Step2: Now install AMD Graphic driver
#sh amd-driver-installer-12-4-x86.x86_64.run

Step3: check log file
#vim /usr/share/ati/fglrx-install.log

there will be an error like this

"ERROR: Module drm is in use by i915,drm_kms_helper"
.
.
"You must change your working directory to /lib/modules/fglrx
and then call ./make_install.sh in order to install the built module."

You can ignore these lines happily if they don’t contain any error message. You don’t really need to execute the command mentioned in those lines.

Step4: Blacklist radeon and radeonhd kernel modules

Add these lines to /etc/modprobe.d/blacklist.conf.

blacklist radeon
blacklist radeo…

Yum command for download list of packages

Some time we need the download the software but not to install.
Also we have a list of software from repository in a text file but need to download by the yum.
To solve this kind of problem we need some trick of Linux,
download the package yum-downloadonly plugin
create a text file with rpm name.
now parse it to yum command
#yum install $(cat rpm-list.txt)

to download only the packages
#yum install <package name> --downloadonly --downloaddir=/home/user/

combine command
# yum install  $(cat rpm-list.txt) --downloadonly --downloaddir=/home/user

create a list from yum.log
#cp /var/log/yum.log /home/user/yum.log

select the package name only
# awk '{print $5}' /home/user/yum.log > rpm-list.txt

view the list
# cat rpm-list.txt

 to query about a package
# repoquery --list <package name>

to take information about package
#yum info <package name>

to show the list of packages
# yum list

to find a package for yum list
# yum list | grep <package name>


Idea behind the blog with name

The idea behind the blogspot should be given to reader who wish to read and be update with this blog.
First understand the title of the blog:-
1. First word "Open" tells you about the nature of the blog content that will be written in the blog.
2. Second word "SOS" tells you about the importance of the content that will be given by it before and after reading.

This whole blog is talk about world's Ethics, Innovation, Future, Life, Satisfaction, Progress, Nature, Science, Technology, Study etc.
On the other side of the world's Electronics, Computers, Servers, Operating System, Linux, Programming, Open Source etc.

This blog is notepad cum share knowledge platform for all other reader who wish to be in touch that i know and follow it.