Posts

Showing posts from May, 2010

The Configuration a system so it does not respond to any ping and it survive a reboot.

Information about ping is stored in a file /proc/sys/net/ipv4/icmp_echo_ignore_all.If its value is 0 then its work normally in the ping.If the value is 1 then its does not respond any ping. #echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all #ping www.google.com(ping is possible) #ping localhost (not possible) now restart the machine. #init 6 #ping localhost(ping is possible) what happen??????? /proc is used to get or set kernel configuration.virtual file system not stored on hard disk,it is stored on ram.Modification apply immediately. To set any parameter change must be done in a file name /etc/sysctl.conf. #vi /etc/sysctl.conf add the following line and save the file:- net.ipv4.icmp_echo_ignore_all=1 save the file using :wq[Enter] #sysctl -p[Reload the settings from sysctl.conf file] #cat /proc/sys/net/ipv4/icmp_echo_ignore_all 1 Result is 1 so it does not respond any ping. #ping localhost[not possible] #init 6 #ping localhost [not possible] Change in a file /etc/sysctl.conf must

Hidden File in Linux

Hidden file is like a regular file with a dot "." prefixed. Syntax:- $touch .[file name] $vi/vim .[file name] Example:- suppose you want to create a file name ' tom ' then the command will be given below:- $touch .tom $vi/vim .tom now you want see the name of the hidden file in a current directory, then command will be given below:- $ls -a a-all files and directories the list will contain both hidden file and regular file. But user want to display only hidden file name in a current directory,then command will be given below:- $ls -a | grep -e "^\." [grep command is used to find regular expression from a file] or $ls -a .*

How to Lock an user account??????

Using help of usermod command we lock a user account.Only a super user can used usermod command. Syntax:- #usermod -L [username] L-Lock user account. Example:- #usermod -L john here john is a user name. Using help of usermod command we unlock a user account. Syntax:- #usermod -U [user name] U-unlock user account. Example:- #usermod -U john here john is a username.

How to know the ip address of an website??

Image
Just create a file name IAdd.java write the following code:- import java.net.*; class IAdd{ public static void main(String a[]) throws Exception{ Socket s=new Socket(a[0],Integer.parseInt(a[1])); InetAddress add=s.getInetAddress(); System.out.println(add); } } now compile the code...... $javac IAdd.java now run the code using following command................ $java IAdd [Host Name] [port number] suppose you want to know ip address of http://www.google.com then the command will be given below:- for http port number is 80 , $java IAdd www.google.com 80 suppose you want to know ip address of ftp://www.wbut.net then the command will given below:- $java IAdd www.wbut.net 21 here port number is 21 becuase control port of ftp is 21.

How to change the login shell of a user????

A normal user only change the login shell of her account.Super user may change the login shell of any account. Using finger command a user check her login shell and super user can check the login shell of any account. #finger example- suppose you want to know login shell of user john then, #finger john Using usermod command superuser can change login shell of any user.suppose super user want to change login shell (csh) of user john then, #usermod -s /bin/csh john superuser only used the usermod command. A user john want to change her login shell (bash) ,then the command will be given below: $bash -s /bin/bash john

How to see the available shell of a machine??

In a linux machine inforamation about the login shell are stored in a particular file name /etc/shells. You must open the file to see the available shell of a machine.Using following command you can see the available shell:- $cat /etc/shells or $more /etc/shells or $less /etc/shells