Friday, April 25, 2014

Install, set up ssh

        SSH

- Ssh allows you to connect to remote host
- provides user and token based authentication
- package name         - openssh_server
- service name        - sssd
- Configuration file     - /etc/ssh/sshd_config

--------------------------------------------------------------------

        ssh Server

# yum install openssh_server -y
# vim /etc/ssh/sshd_config
  Insert mode
  Shift+G
  Press 'o' for new line
  Allowusrers tom        // Allow/deny users; if nothing mentioned
  Denyusers harry            all will be allowed by default
  :wq
# service sshd restart

---------------------------------------------------------------------------------------

        ssh client

# ssh username@ipaddress

Example :

# ssh tom@192.168.0.28

use -X or -Y option to get the graphical tool access

# ssh -X 192.168.0.28
  Enter password
  Try,
# system-config-date

-----------------------------------------------------------------------------------------

        ssh Keyless Authentication

Pubilc key needs to be saved
Keybase Authentication :
i.)  dsa
ii.) rsa


Condition : To login without password using ssh

i.) dsa

# su - user
# ssh-keygen-t dsa        // use any option : dsr or rsa
Enter+Enter+Enter        // Your Public key is saved in /.ssh        # cd .ssh            // under user home directory
# scp -rp id_dsa.pub 192.168.0.25:/home/user
Here,
-rp = with permission
Source = id_dsa.pub
Destination = 192.168.0.25:/home/user

ii.) rsa

# su - user
# ssh-keygen-t rsa
# ssh-copy-id -i id_rsa.pub 192.168.0.19    // for sending the public key

Now Try,

# ssh 192.168.0.19

------------------------------------------------------------------------------------------

ssh commands

i.) SCP command

# scp filename 192.168.0.19:/destination         // Secured Copy
Example :
# scp -rp id_dsa.pub 192.168.0.25:/home/user

ii.) seq command

seq 111111>filename            // will write 11111 lines in sequence in file

iii.) rsynch command

Condition : If you want the data appended to the file to only send to destination

rsynch sumit 192.168.0.19:        // this will save time and bandwith both

------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------

No comments:

Post a Comment