Skip to content
  • Home
  • About
  • Contact

How To Tutorials

PHP, ASP, .Net, Linux, SEO

Day: March 29, 2014

Create SSH only login to Linux servers

March 29, 2014March 29, 2014Ananda Raj Pandey1 Comment

SSH login to Linux server

SSH login with provide more security to the server.  It provides extra layer of security for the server.  It uses public – private key authentication with server which prevents anyone login to the server with out private key. That means login with simple username and password can be depreciated and new two level of security can be added.

 

Generate public / private key:

We can generate keys by different ways. For better understanding please click here.

Create SSH login for User.

ssh-keygen rsa -f  newuser

 

 

a) Copy your public key to authorized_keys

i)  If you are trying to get SSH login for root then copy it to root .ssh folder.
cat mykey.pub >> /root/.ssh/authorized_keys
ii) If you are setting for particular user then copy it to that user folder
cat mykey.pub >> /<user folder>/.ssh/authorized_keys

 

 

b) Restart sshd server:
service sshd restart

 

Enable SSH only login:

vi  /etc/ssh/sshd_config
Set:
PasswordAuthentication no

 

If we need to set SSH login to particular users only then, set that user name in Allowusers parameter.

 

AllowUsers root, newUser

 

 

Share this:

  • Twitter
  • Facebook
  • LinkedIn
  • Pocket
  • Pinterest
  • Tumblr
  • Reddit
  • Print

Like this:

Like Loading...
Linux, Securityananda raj pandey, Linux, SSH login, SSH only login

Categories

  • apache (15)
  • AWS (2)
  • Classic ASP (1)
  • Cloud (2)
  • Cpanel (4)
  • Elasticsearch (2)
  • git (2)
  • Jquery (1)
  • Linux (33)
  • MsSql (2)
  • Munin (3)
  • Mysql (10)
  • Nginx (2)
  • PHP (7)
  • Security (8)
  • SEO (1)
  • Server Optimization (13)
  • Uncategorized (13)
  • virtualmin (5)
March 2014
M T W T F S S
« Feb   Apr »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Recent Posts

  • Elasticsearch: FORBIDDEN/12/index read-only / allow delete (api) error
  • AWS: CloudFront 502 bad gateway error
  • AWS: CloudFront 504 timeout error
  • Elasticsearch: Cluster Setup
  • Postfix: Forward all outgoing emails to one email address on Centos / Redhat

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 404 other followers

Tags

ananda raj pandey Apache centos Linux Munin Mysql Mysql optimization Nginx Server virtualmin
Blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
%d bloggers like this: