As we all know, FreeBSD ssh default login is not directly log in with root, so that you can protect against some SSH sniffer attacks, and secondly, ordinary user operations can avoid some "security incidents." But unfortunately, the CentOS series default SSH can be root directly login, so the harm is too large, the shell written below this article, will greatly simplify the configuration of CentOS Normal user ssh login, to avoid errors caused by SSH login failure.
#!/bin/bash#desc:written by cuixh blog.zjyxh.comuseradd userecho "user" >/etc/sshuserssed-i ' 1aauth required Pam_lis tfile.so item=user sense=allow file=/etc/sshusers onerr=fail '/etc/pam.d/sshdsed-i "12aPort $RANDOM"/etc/ssh/sshd_ Configsed-i "s/#PermitRootLogin yes/permitrootlogin no/"/etc/ssh/sshd_configsed-n "13p"/etc/ssh/sshd_config/sbin/ Service sshd Restart
Copy this script to chssh.sh and execute the script in the current directory. For example, Bash chessh.sh. or download ready-made chssh.sh, such as wget Http://docs.zjyxh.com/linux/system/chssh.sh;bash chssh.sh;
Finally set user user password, passwd user
This article is from the "Tri Xiaohui blog" blog, make sure to keep this source http://coralzd.blog.51cto.com/90341/1699439
Linux enable specified user login, cancel root ssh login