Pages

Saturday, February 4, 2012

Configuring ip for lan while connecting two users using ssh.

Firstly, while connecting lan between two users using an lan cable, you have to neccessarily set the ip for two users. for this, after connecting the lan cable between two systems, now type:

              sudo ifconfig
  to check whether ur ip is set or not. If the 'inet6 addr :' is blank as shown above. Then u have to set the ip. For this type,

              sudo ifconfig eth0 192.168.1.4
 the 3rd one ie, 'eth0' may be different in different systems, suppose 'eth1' is another one. As it is shown when u type ifconfig, now regarding ip, '192.168.1.' is general used for lans based on class addresses. Now rest you can decided, i have given '4' to last one. Each system should have different ip, one system with '192.168.1.4' and another with '192.168.1.6' as you like.


ssh :secure shell 
for sharing the files through lan or wifi, you need ssh. You need to check whether the connection is established between two users, ie, type ' ping ' followed by the ip of the other computer to which u have connected. for eg:

ping 192.168.1.4

After that, type ssh in terminal to access the other systems terminal, following the ip of the other ie.


sudo ssh 192.168.1.4


Also graphical u can share a folder in you system or mount the other computer folders using the ssh, for this go to the 'connect to server' and choose the ssh and then type the ip of the other system.


if an error occurs indicating " host authentication or verification key failed" then, u have to remove the key, since changing lan connections with different system with ubuntu may arise this errors. Actually, the host key had been changed for the currently connecting system. so change the host key using the command :

ssh-keygen -f [path of hostkey filename] -R [ip of connecting system]

 sometimes, defaultly the hostkey filename would be in location '/home/[username]/.ssh/known_hosts'. Replace [username] with ur systems username.
 
you can also try the below one for the problem 
" ssh: connect to host 192.168.2.4 port 22: Connection refused "


Actually , The above error looks more like sshd is not running on host 192.168.2.4 .Try installing 'openssh-server' and if it doesnot work, then try below one:

#cd /root/.ssh

#vi known_hosts
*delete everyting on that file

#service sshd restart


No comments:

Post a Comment