How to kill process running on some port?

I have been facing a problem of how to kill a process running on some port. After some digging out on net i found out.

Here is a command line code (sort of shell script)

lsof | grep IPv | grep 3001 | awk '{print $2}' | xargs -l -i kill -9 {}

It did work for me :).

ls: .: Stale NFS file handle + Samba + Windows 2003 Server

It has been long time since i have configured anything on linux machine. It has been many times we need to do networking between windows and linux machine, it can be done with samba very easly as per we all know. Anybody who don’t know what is samba, then visit Samba Website for more infromation on samba.

I have windows 2003 server which is usually in networking with linux machine. Problem has been started when i mounted windows 2003 share on linux. When i do “ls” command its giving me “ls: .: Stale NFS file handle”, this error is most common error found by everybody. I tried to find solution for it but no luck. Some how i have manage to get the solution.

There are one important step when you issue smbclient. Use following smbclient command:

smbclient -L WindowsMachineName -U WindowsMachinePassword

Do not use ip instead of windows machine name. Always use Machine name.

Now next step is to do mounting of windows share to linux.

mount -t smbfs -o username=”MachineName\Username”,password=”Password”
//MachineIP/SharedName /mnt/SharedDirectory

Create same sharenamed directory inside your /mnt directory. Suppose you have sharename “abcd” on windows machine then create directory “abcd” inside the /mnt directory of linux.

Now use the following mount command to mount the windows share.

After issue above command try to do ls /mnt/Shared Directory in our case it will be /mnt/abcd, you will probably get this error:
“ls: .: Stale NFS file handle”

This is where you mostly stuck and start looking or finding solution for it.

Lets solve is the most common solution that works for me.

Just a quick note in relation to Windows 2003 Servers.

You may receieve this error message if your server is “Digitally signing” communications.

To disable this, alter two policies, in the Default Domain Controller Security Settings. Under Local policies, Security Options.

Disable Microsoft network server: Digitally sign communications (always)
Disable Microsoft network server: Digitally sign communications (if client agrees)

Remember to run gpupdate.exe when finishes or you’ll have to wait for Windows to do it at the scheduled interval.

After you did this umount that shared on linux and mount it again.

If you do now ls command, You can see all directories and files of your windows shared on mounted directory in linux. I hope this can be usefull to everybody who facing same problem.

Post your comment if you are having still difficulty or another kind of solution for same situation.

Note: I assume who are reading this, knows already how to install, setup and configure samba.