Friday, December 21, 2012

Automation - System Administration.

System administrator writes scripts that the system can execute at a particular time each day,week or month. Tasks that are common and often repeated,tedious are best performed through automation. Two question came in our mind when think about automation which are "What can be automated?" and "What should be automated?". Following are few tasks that can be performed through automation.

1) Adding new users
2) Process monitoring
3) File search and removal.
4) Configuration changes on servers.
5) Getting servers information.( Big environment)
6) Software Installation.
7) Remote administration tasks.

The above tasks can be performed by writing scripts. Scripts are program that can interact with the operating system using OS commands.There are many scripting language that can be used to write scripts like shell(Korn,bash),Perl,Python and others.

Tasks can be automated with cron services where we can execute certain scripts at a particular time,day,week or month.

Tuesday, December 18, 2012

5 Useful Linux Touch command

1) Create an empty file
Below will create  0 bytes file called 'test123'. It will change the modification/access timestamp.

#touch test123

Touch -c avoid creating non-existence file.

2)Create new file's timestamp

#touch -t 05070915 test123

3)Change modification time

# touch -m test123

4) Change access time

# touch -a test123

5)Copy  other file's timestamp.

#touch try123 -r test123




Friday, June 15, 2012

$PATH

To export

export PATH=$PATH:/home/velayuts/Desktop
To delete

del=':/home/velayuts/Desktop';export PATH="${PATH//$del}"

Tuesday, November 22, 2011

SSH Trust:SSHv2 to SSHv2

Steps To configure as follows:
FSecure SSH v2 --> FSecure SSH v2Case Study: ssh trust for user kumar from Sun to Moon

1) sun:-->ssh-keygen2 -t dsa
(Key will be generated at user's home - /home/kumar/.ssh2)
2) sun:/home/kumar/.ssh2-->cp id_dsa_1024_sun_a kumar@sun. (This step is done to give some useful name and to avoid confusion.)
3) sun:/home/kumar/.ssh2-->cp id_dsa_1024_sun_a.pub kumar@sun.pub (This step is done to give some useful name and to avoid confusion.)
4) sun:/home/kumar/.ssh2-->echo 'IdKey
kumar@sun' > identification ('Identification' file will be created)
5) Copy kumar@sun.pub to remote host's(moon) /export/home/kumar/.ssh

6) moon#:/home/kumar/.ssh2-->echo 'Key mathamsv@oktstcl1.okla.seagate.com.pub' > authorization
7)Done.Now user 'kumar' can ssh without password from Sun to Moon.

Wednesday, October 12, 2011

To Capture/Record Unix command

There is way to record/capture what ever commands executed in Unix. You can use 'script' command where all the command dumped to a file that we specify and this process executed at the background. This is very useful when we do some software installation and we are able to capture all the steps and commands that we used.

#script ApacheInstallationSteps.txt
Script started, file is ApacheInstallationSteps.txt
#
#exit
Script done, file is ApacheInstallationSteps.txt
#

Friday, October 7, 2011

Linux:Steps to change root password

Steps to change root password:

1)When GRUB is started press any key followed by 'a' to modify the kernel arguments before booting.

2) Add 1 or single at the end of line and press 'b' to boot to the single user mode.

3) Once single user mode started you can run 'passwd' command to set new password for 'root'.

4) Exit or reboot the server once password has been reset.

LSOF command

Usage example:

#lsof -i TCP (Show all open TCP files)

#lsof -i TCP:80 (Show open TCP files on port 80)

#lsof -c passwd (to find out what files opened when execute this command)

#lsof /dev/sda3 ( which files opened for a device)