Sunday, 17 April 2016

How to configure SSH access to localhost ?


Target : To configure SSH access to localhost
Assumption : Ubuntu is installed in PC

1. Install Open SSH Server
# sudo apt-get install openssh-server
# sudo apt-get install ssh
# sudo apt-get install rsync
 
2. Add new group 'hadoop' and new user 'hduser' in group 'hadoop'
Optional : Skip this step if your want access from current user, not a new user
# sudo addgroup hadoop
# sudo adduser -ingroup hadoop hduser
Enter password : hadoop123
Enter personal information
 
Add hduser to sudo group to have all rights
# sudo adduser hduser sudo

3. Configure SSH access
Login as hduser (New User) and run this Key generation command :
$ ssh-keygen -t rsa -P ""
 
Provide the file name in which to save the key : JUST ENTER 
It will generate ID and key at : /home/hduser/.ssh/id_rsa and /home/hduser/.ssh/id_rsa.pub 

Enable SSH access to your local machine with this newly created key
$ cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
 
4. Test SSH setup 
Switch to other user
$ su - shaan

Try connecting to your local machine with the 'hduser'
$ ssh hduser@localhost
 
This will add localhost permanently to the list of known hosts.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.