Subscribe  RSS
  • About Me

OpenPeta

Open Mind …. Open Source …


  • Administration
  • Basic Commands
  • C Language
  • compilation
  • Configuration
  • Image Processing
  • Installation
  • Internet
  • Kernel
    • Assembly Language
  • Linux on NoteBook PCs
  • MySQL
  • Open Source Programming
  • Seamntic Web
  • Softwares and EBooks
  • Tips and Tricks
  • Ubuntu Linux
  • Uncategorized
  • Weblog

How to shutdown all linux clients from server in your network (LAN)

By admin on October 12th, 2007

Consider this scenario,This is the sample LAN. Now i am going to configure the server and 3 clients (for shutting down 3 clients from server) .Using Secure Shell (SSH) , we can execute any terminal commands like shutdown and halt on the remote system. but we need to enter the password for connecting remote system. By configuring public key both server and client , we can easily logon to the remote system without using password and then we can execute the shutdown command

Server Side (192.168.3.100)
1) Generate public key

root@myserver#ssh-keygen -t dsa -f .ssh/id_dsa
Generating public/private dsa key pair.
.ssh/id_dsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in .ssh/id_dsa.
Your public key has been saved in .ssh/id_dsa.pub.
The key fingerprint is:
a6:3e:4d:48:af:73:04:d0:53:82:7d:ba:98:b6:fb:dd root@myserver

(Leave passphrase – Simply press enter key]

2) copy the server (192.168.3.100) public key to remote system (192.168.3.101)

root@myserver#cd .ssh
root@myserver#scp id_dsa.pub root@192.168.3.101:~/.ssh/id_dsa.pub
The authenticity of host ’192.168.3.101 (192.168.3.101)’ can’t be established.
RSA key fingerprint is 5c:5b:84:54:a9:95:6b:64:85:74:9b:cc:ce:60:ed:1d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ’192.168.3.101′ (RSA) to the list of known hosts.
root@192.168.3.101′s password:
id_dsa.pub 100% 603 0.6KB/s 00:00
root@myserver#

3) login to remote host(192.168.3.101) from local (192.168.3.100)

root@myserver#ssh -X root@192.168.3.101
root@192.168.3.101′s password:
Last login: Fri Oct 5 11:51:37 2007
Starting MySQL: [ OK ]
Starting httpd:
[root@client1 ~]#

4) In remote system append the public key to authorized_keys file

[root@client1 ~]# cd .ssh
[root@client1 .ssh]# cat id_dsa.pub >> authorized_keys
[root@client1 .ssh]# chmod 640 authorized_keys
[root@client1 .ssh]# rm id_dsa.pub
rm: remove regular file `id_dsa.pub’? y
[root@client1 .ssh]#exit

5) Now you can logon to the remote (192.168.3.101) system without password from your server (192.168.3.100)

6) Execute the shutdown command from server (for shutdown the client)

root@myserver#ssh -X 192.168.3.101 halt

The same way you can configure the client 2, and client 3 systems .

If the network has more number of systems , then you can use the following shell script in server for shutting down all client machines after configuring the public key on all machines

[root@myserver ~]# vi ssh-shutdown.sh
for (( $i=100 ; $i<=250 ; $i++ ))
do
ssh -X root@192.168.3.$i halt
done

(This program will shutdown the all network client system from 100 to 250)

Categorized under: Administration, Remote Login Protocols.
Tagged with: no tags.

3 Responses to “How to shutdown all linux clients from server in your network (LAN)”

  1. sayera says:
    July 22, 2010 at 11:10 am

    we cannot run this key gen comman in BASH

  2. sayera says:
    July 22, 2010 at 2:46 pm

    in the 2nd what is the password to be entered .iam entering the client root password but it is not accepting and also i tried the publickey which is saved in “.ssh/id_dsa.pub” it is not accepting that to..so please tel me the solution .if i know that this is very much useful to our system thankq

  3. admin says:
    July 23, 2010 at 6:06 am

    Try ITALC
    http://italc.sourceforge.net/

Leave a Response

Click here to cancel reply.

← 'tail' command
Group Management →

Recent Activity

  • Posts
  • Comments
  • Ubuntu Tweak – Customise Your Desktop
  • Ubuntu 10.04 – Enabling Location Based Address Bar Permanently in Nautilus File Browser
  • University Timetabling System [ Unitime ] in Linux
  • How to Reset MySQL Server Password ?
  • Ubuntu 10.04 Beginners Manual
  • 8085 Two Pass Assembler – Sample Program
  • 10 Myths About Ubuntu Linux Operating System
  • Ubuntu 10.04 – Enabling Address Bar in Nautilus File Browser
  • 10 Basic Linux Commands
  • Gparted – Partition Log File for My 1TB Hard Disk
  • sunil kumar on 8085 Two Pass Assembler - Sample Program
  • admin on How to shutdown all linux clients from server in your network (LAN)
  • sayera on How to shutdown all linux clients from server in your network (LAN)
  • sayera on How to shutdown all linux clients from server in your network (LAN)
  • keerthana on 8085 Two Pass Assembler - Sample Program
  • Ranjib on 2D Graphics Using C in Linux [ Graphics.h in Linux ]
  • admin on 2D Graphics Using C in Linux [ Graphics.h in Linux ]
  • Ranjib on 2D Graphics Using C in Linux [ Graphics.h in Linux ]
  • Thameem on NOKIA E51 wlan/wifi connection problem and solution
  • Thameem on NOKIA E51 wlan/wifi connection problem and solution

Archives

  • Categories
  • Tags
  • Dates
  • Authors
  • Administration
  • Basic Commands
  • C Language
  • compilation
  • Configuration
  • Image Processing
  • Installation
  • Internet
  • Kernel
    • Assembly Language
  • Linux on NoteBook PCs
  • MySQL
  • Open Source Programming
  • Seamntic Web
  • Softwares and EBooks
  • Tips and Tricks
  • Ubuntu Linux
  • Uncategorized
  • Weblog
Linux Open Sourc Ubuntu
  • July 2010 (2)
  • June 2010 (4)
  • May 2010 (4)
  • April 2010 (12)
  • March 2010 (8)
  • February 2010 (4)
  • January 2010 (3)
  • December 2009 (1)
  • October 2009 (2)
  • September 2009 (5)
  • August 2009 (1)
  • July 2009 (2)
  • June 2009 (5)
  • May 2009 (11)
  • April 2009 (2)
  • March 2009 (3)
  • February 2009 (6)
  • January 2009 (1)
  • October 2008 (5)
  • August 2008 (1)
  • July 2008 (6)
  • June 2008 (3)
  • April 2008 (1)
  • March 2008 (6)
  • February 2008 (13)
  • December 2007 (4)
  • October 2007 (11)
  • September 2007 (25)
  • August 2007 (7)
  • ANTHONIRAJ (36)
  • raja (2)
  • RAJARAJAN (6)
  • somnath (1)

Open Peta Calendar

October 2007
M T W T F S S
« Sep   Dec »
1234567
891011121314
15161718192021
22232425262728
293031  
Powered by WordPress and the PressPlay Theme
Copyright © 2010 OpenPeta