Data Networking/Fall 2014/Priya/Web Server - openSSH-server & client configuration

From Wikiversity
Jump to navigation Jump to search

1. Web Server - openSSH-server
To install openSSH-server and generate public and private keys, do the following steps

    sudo apt-get install openssh-server
    sudo nano /etc/ssh/sshd_config
Change port to 555 (or other port that suits your flavor)
    Port 555
Modify the following lines to permit the server and client to communicate using the public keys
    RSAAuthentication yes
    PubkeyAuthentication yes
    
    AuthorizedKeysFile      %h/.ssh/authorized_keys
    
    PasswordAuthentication no
Create .ssh directory and generate ssh keys
    mkdir ~/.ssh
    chmod 700 ~/.ssh
    chown $USER:$USER ~/.ssh
    ssh-keygen -t rsa

2. Remote Client - openSSH-client
To install openSSH-client and generate its private and public keys, do the following steps

    sudo apt-get instal openssh-client
    sudo nano /etc/ssh/sshd_config
Modify the following lines to permit the server and client to communicate using the public keys
    RSAAuthentication yes
    PubkeyAuthentication yes
    
    AuthorizedKeysFile      %h/.ssh/authorized_keys
    
    PasswordAuthentication no
Create .ssh directory and generate ssh keys
    mkdir ~/.ssh
    chmod 700 ~/.ssh
    chown $USER:$USER ~/.ssh
    ssh-keygen -t rsa
Copy the public key from client to server
    sudo scp /home/kuldeep/id_rsa.pub peterkelada@x.x.x.x:/home/peterkelada
    ssh-add

Finally, after successfully installing and configuring openSSH on both server and client, you can access the server at port 555 using the following command

    sudo ssh -p 555 peterkelada@x.x.x.x