LEARN HOW TO BLOCK ALL USERS TO LOGIN AND HOW TO LOCK USB IN LINUX

In this post i’ll show you how to block all users to login  and also how to lock pendrive/usb in linux . Sometimes we doesn’t want anyone to enter to our system through usb port and use usb drive to copy our data  or put some virus in our system . With this trick no one will be able to put pendrive/usb in your linux system except you . We will also learn how to block all users to login except root (admin) .

 

  1. HOW  TO LOCK PENDRIVE / USB IN LINUX 

lock pendrive/usb

  • Open grub configuration file through vim
[root@localhost ~]# vim /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/sda1
#          initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-164.el5)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-164.el5.img
~
~
~
~
~
  • Press I to enter insert mode
  • We have to make small changes in this configuration file .
  • Did you see the kernel line ( highlighted in blue color ) , type  no usb at the end of the line .
  • Some people have two or three kernels in their system , SO type no usb in front of that kernel in which you want to lock pendrive .
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/sda1
#          initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-164.el5)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet no usb
        initrd /boot/initrd-2.6.18-164.el5.img
~
~
~
~
~
  • Now press ESC and type :wq ( to save and quit)
~
~
:wq

No malicious user will be able to connect their pendrive or usb to your system . Whenever you want to use your pendrive / usb simply remove both words (no usb) .

2. HOW TO BLOCK ALL USERS TO LOGIN IN LINUX 

blocked users

  • Go to /etc path where all system configuration file is located
  • And create one file named nologin
[root@localhost ~]# cd /etc/
[root@localhost etc]# touch nologin
[root@localhost etc]#
  • Now try to login with any user in any terminal . System will ask for username and password but won’t allow to login any users except ROOT ( admin) .
  • If you want to allow all users to login simply delete that file .
[root@localhost etc]# rm -rf nologin

 

 

WHAT’S FINGER SERVER AND HOW TO CONFIGURE FINGER SERVER IN LINUX .

VIRUS IN LINUX . LEARN HOW TO INSTALL AND RUN AVG ANTIVIRUS IN LINUX

WHAT’S STELNET AND HOW TO CONFIGURE STELNET IN LINUX AS SERVER AND WINDOWS OR ANDROID AS CLIENT

 

One thought on “LEARN HOW TO BLOCK ALL USERS TO LOGIN AND HOW TO LOCK USB IN LINUX

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s