Killing a running process in an Ubuntu machine remotely from a windows machine which is in LAN

6,336

Solution 1

Install openssh-server on Ubuntu and PuTTY on Windows. Then you can get a shell on your Ubuntu machine from the Windows one.

Once logged into your Ubuntu machine remotely, you can use kill or pkill or killall as you prefer. I find pkill simplest if you just want to kill based on the process's name. For example: pkill firefox

If, however, you wanted to kill a specific process whose PID (process ID) you know (possibly from looking through the output of ps -ef), you can use kill 1234

You can combine kill signals with these to say how they should be killed. The default is 15, or SIGTERM (term = terminate), which is a polite request to please close now. If a process doesn't respond to that, 9 (SIGKILL) is popular. See man 7 signal for more information about signals. To use this with kill or pkill you'd simply add -9 for example: kill -9 firefox

Solution 2

If you are running an ssh daemon on your Ubuntu machine then you can login via SSH using PuTTy from your windows machine.

Once you are logged in, you can look at the current running processes with the ps aux command and then use kill or pkill to end the task

Note: You may need to use sudo with the kill commands

Solution 3

If you have sshd installed on the Ubuntu box (almost always a good thing) you can connect and kill the process as normal (e.g. killall process, or similar).

On the Ubuntu box:

$ sudo apt-get install ssh

On Windows, download PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/

Open PuTTY and set it to connect to the Ubuntu box's IP address (e.g. 192.168.0.1). You should be presented with a login prompt, so provide your Ubuntu username and password.

As maco has already said, there are a variety of ways of killing processes - just take your pick of pkill, killall etc., e.g.:

$ killall firefox
Share:
6,336

Related videos on Youtube

Renjith G
Author by

Renjith G

Working as a system programmer

Updated on September 17, 2022

Comments

  • Renjith G
    Renjith G over 1 year

    Is it possible to kill a process running in an Ubuntu machine from a Windows(XP) machine remotely connected via LAN ?

    I can kill the process in a windows machine from a remote windows machine (in LAN) by the following command,

    taskkill /S system /U username /P password /IM process.exe
    

    Is there any thing like that to kill the process running in the Linux machine ?

  • Renjith G
    Renjith G over 13 years
    Can you mention it clearly with steps?
  • Joe Phillips
    Joe Phillips over 13 years
  • maco
    maco over 13 years
    hehe I was humming that in my head as I typed
  • Renjith G
    Renjith G over 13 years
    sudo apt-get install openssh-server is enough to install open ssh server in ubuntu?
  • maco
    maco over 13 years
    Yes. Clicking the link I provided will automatically start up apt on your computer too.
  • Renjith G
    Renjith G over 13 years
    Thanks..but now am not in Ubuntu!!! ;-)