Disable the SSH access permission for the newly created account under CentOS

Source: Internet
Author: User
Tags ssh access
Sometimes we need to create a user-defined account. Generally, the newly created account can log on to the server using the ssh tool. to improve security, we must disable the SSH login permission for this account. 1. create an account and directly disable logon to useraddkwxgd-s/sbin/nologinSSH to execute the preceding commands. create a new account named kwxgd and grant the login prohibited permission. II. set password p

Sometimes we need to create a user-defined account. Generally, the newly created account can log on to the server using the ssh tool. to improve security, we must disable the SSH login permission for this account.

 


1. create an account and directly disable logon
useradd kwxgd -s /sbin/nologin

Run the preceding commands in SSH to create an account named kwxgd and grant the login prohibited permission.


2. set the password
passwd kwxgd

Run the preceding command in SSH to add the password for "kwxgd.


3. what should I do if I forget to set permissions if I have added an account?
1. edit a file
vi /etc/passwd

2. find the corresponding user name and modify the login configuration

The default write parameters are:/bin/bash, which can be changed to/sbin/nologin in format.

After modification and save, it will be OK.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.