How to Install SSH Server in Linux

SSH (Secure Shell) is typically used to login into a remote machine and execute commands, but it also supports tunneling, forwarding TCP ports and X11 connections. It can transfer files using the associated SSH File Transfer(SFTP) or Secure Copy(SCP) Protocols.

$sudo apt-get install rsync ——- (Remote Sync)
$sudo apt-get install openssh-server ——-[Default port is 22]

After install ssh server, we have to generate SSH Key by using below command
$ssh-keygen -t rsa -P”” ———-[It will generate id-rsa.pub file]

Next you have to enable SSH access to your local machine with this newly created key.
$cat $HOME/.ssh/id-rsa.pub >> $HOME/.ssh/authorized-keys
$chmode 0600 ~/.ssh/authorized-keys

To be sure that SSH installation is went well, you can open a new terminal and try create ssh session using login user by the following command

$ssh localhost
$ssh -vvv username@localhost
-vvv ——[very,very verbose mode]

if not connected ssh properly you can add user name will all permission in “sudoers” file.In that file add the following line below “# user previlage specification ”
$sudo nano /etc/sudoers
username ALL=(ALL:ALL) ALL

While editing sudo file if any error occurs use this command to fix it
$pkexec visudo

Any edition happen sshd-config file we have to reload it by using below command
$sudo /etc/init.d/ssh reload

How to install Java in Linux

To install java in Linux(ubuntu) we have to execute below commands
$sudo apt-get update

$sduo apt-get install default-jre
$sudo apt-get install default-jdk
(or)
if you want latest version java
$sudo apt-get install openjdk-7-jre
$sudo apt-get install openjdk-7-jdk

when there are multiple installation of java in linux
$sudo update-alternatives –config java
(or)
$sudo update-alternatives –config javac

Copy the path above any one(For which version of java installation) For setting JAVA_HOME
$sudo nano /etc/environment
JAVA_HOME=”place here java path”

Test: echo $JAVA_HOME