Solved

let root login using ssh-keys and disable all other users onlinux

Posted on 2010-09-01
6
425 Views
Last Modified: 2012-05-10
Is it possible?

Thanks.
0
Comment
Question by:sminfo
6 Comments
 
LVL 29

Accepted Solution

by:
fosiul01 earned 250 total points
ID: 33577732
yes that possible

you just need to add   /sbin/nologin word with each users in /etc/passwd file .  ( there is a command which you can use instead of editing /etc/passwd file)

example :

nobody:x:99:99:Nobody:/:/sbin/nologin


and in sshd_config file

insert this line

PermitRootLogin without-password


then reboot the sshd daemon

it will allow root to use key only and

by editing /etc/passwd file ( sbin/nologin) it will prevent to user to login to the server.


0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 250 total points
ID: 33577870
You could also add to sshd_config
AllowUsers root
PermitRootLogin without-password

and disable all remote access like telnet, rsh and the like.
Remains only the phyical system console - is this a concern for you?

 
0
 
LVL 3

Expert Comment

by:simoesp
ID: 33578201
you can  always block an account by doing

passwd -l

then generate an ssh key to login without password

0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 3

Expert Comment

by:fernandomerces
ID: 33583469
I don't know the /sbin/nologin program. I use /bin/false instead.

BUT I really recommends that you use a normal account to login via SSH and then elevate your privileges to root (su/sudo). Believe, you don't need root logged all time and you'll increase security.

Regards,

Fernando
0
 
LVL 12

Expert Comment

by:mccracky
ID: 33632679
I would concur with fernandomerces AND woolmilkporc.

Use the sshd_config with allowusers and don't log in directly as root.
0
 

Author Closing Comment

by:sminfo
ID: 33796700
The answers are fine and solved my question.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now