Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Security»How to Deny/Allow Access for Users & Groups in OpenSSH

    How to Deny/Allow Access for Users & Groups in OpenSSH

    By RahulJuly 21, 20152 Mins Read

    For security purposes many times we required to restrict or allow for SSH access for specific Users or Groups. To make any changes edit OpenSSH configuration file /etc/ssh/sshd_config and do required changes for allowing or denying any user or group.

    Advertisement

    Allow/Deny Users and Groups:

    To allow or deny any user or group on OpenSSH, first edit configuration file /etc/ssh/sshd_config in your favorite editor and do changes as following examples.

    1. Deny Users: To restrict for block specific user for SSH on server add the following rules. For example to restrict users raj, tyler and sarah.

    DenyUsers  raj  tyler  sarah
    

    2. Deny Groups: In place of restricting specific users we can also restrict groups in OpenSSH. For example to restrict support and marketing groups from ssh add following rules.

    DenyGroups  support  marketing
    

    3. Allow Users: By default all users are allowed to login to OpenSSH server. But we can specifically allow any user, For example jack and richard belongs to support group and we already have restricted that group members. So we can specify that users in Allow users to allow them specifically.

    AllowUsers  jack  richard
    

    4. Allow Groups: Similarly we can allow all the members of specific group which may be denied in any other group. For example user andrew and peter belongs to marketing group as well as admin group. So we can allow access to both users by allowing admin group.

    AllowGroups  admin
    

    Restart OpenSSH:

    After doing any changes in configuration file, make sure to restart OpenSSH service as following.

    # service sshd restart
    or
    # systemd restart sshd
    

    OpenSSH security SSH
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Preventing SQL injection attacks with prepared statements in MySQL

    Firewalld: Common Firewall Rules and Commands

    How to block bad bots using .htaccess

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.