Thursday, February 21, 2008

Display Primary and Secondary DNS in Linux

Type the following to display the DNS servers being used by your system

$ cat /etc/resolv.conf

Tuesday, January 15, 2008

Terminal Emulation for Linux

For security and remote administration reasons you can "screen" out of your working terminal and close out of your shell and have access to the working shell remotely and local when you need it. To do this follow the steps below.

Su to root:
$su -
type:
# screen
Now type your commands:
# tshark -i xxxxxxxx
Now hold down the following keys at the same time:
# CTRL + a + d
This detaches the screen and allows you to exit the terminal window.


To access the detached terminal do the following:
From local:
$ su -
# screen -R
This gets you back into the terminal you were working on.

From remote:
ssh to the server
$ su -
#screen -R
You will she your command still running.


Thanks to scm for showing me this.

Monday, December 24, 2007

Set date and time on linux

To change the date and time from a command line type the following:

sudo date -s "24 DEC 2007 9:00:00"

The format is "day MONTH year time"

Monday, October 29, 2007

tshark filter example

Here is a way to capture traffic with tshark and only get what the display filter is showing.

tshark -i 2 -f "port 110" -R "pop.request.parameter conatins "user"" > c:\port110.txt
*********************try "pop.request.command conatins "USER""*************

This will capture all port 110 traffic and filter out the "user" command line and save it to a txt file.

tshark -i 2 -f "port 25" -R "smtp.rsp.parameter contains "Sender"" > c:\port25.txt

This is an example of how to capture traffic on your outbound smtp server.

-i = interface
-f = capture filter
-R= display filter

Wednesday, October 17, 2007

How to mount a remote Windows share from Linux

1) Make sure you have following information:
==> Windows username and password to access share name
==> Sharename (such as //server/share) or IP address
==> root level access on Linux

2) Login to Linux as a root user (or use su or sudo)

3) Create the required mount point:
# mkdir -p /mnt/ntserver

4) Use the mount command as follows:
# mount -t cifs //ntserver/download -o username=vivek,password=myPassword /mnt/ntserver

Use following command if you are using Old version such as RHEL <=4 or Debian <= 3: # mount -t smbfs -o username=vivek,password=D1W4x9sw //ntserver/download /mnt/ntserver

5) Access Windows 2003/2000/NT share using cd and ls command:
# cd /mnt/ntserver; ls -l

Where,

  • -t smbfs : File system type to be mount (outdated, use cifs)
  • -t cifs : File system type to be mount
  • -o : are options passed to mount command, in this example I had passed two options. First argument is password (vivek) and second argument is password to connect remote windows box
  • //ntserver/download : Windows 2000/NT share name
  • /mnt/ntserver Linux mount point (to access share after mounting)
credit - http://www.cyberciti.biz/tips/how-to-mount-remote-windows-partition-windows-share-under-linux.html

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

To have the share mount on startup do the following:

$ sudo kate /etc/fstab

add at the bottom of the file:
//ntserver/share /mnt/ntserver cifs username=user,paswsword=pass 0 0
>>>>>>>>>space>>>>>space>space>>>>>>>>>>>>>>>>>space>space
Note: make sure you hit enter a few times after your last line to avoid errors.

Now when you restart your machine you should be able to see the windows share by typing " ls /mnt/ntserver"

Thursday, October 4, 2007

Adept behind a Proxy

Credit - http://www.catnip.co.uk/projects/gnu/linux/usw/


Using Adept Behind a Proxy

If your machine is behind a proxy firewall, it is still possible to use Adept to keep the system up to date and to install further software. The way I did it was to create a file:

/etc/apt/apt.conf.d/proxy

by issuing the command:

sudo kwrite /etc/apt/apt.conf.d/proxy

and to place in it the details of the proxy as follows:

Acquire {
http {
Proxy "http://username:userpassword@191.168.1.1:8080";
};
};

Obviously replace username, userpassword, the IP address 191.168.1.1 and the port number 8080 with those applicable to the proxy you wish to access.