禁止root直接登陆linux系统

直接修改文件

# vim /etc/ssh/sshd_config

SyslogFacility AUTHPRIV
PermitRootLogin no
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile	.ssh/authorized_keys
PasswordAuthentication no
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
X11Forwarding yes
Subsystem	sftp	/usr/libexec/openssh/sftp-server
/etc/init.d/sshd restart

  如何免密码切换到root呢?

vim   /etc/sudoers

【普通账号】 ALL=(ALL) NOPASSWD: ALL

保存之后,回到普通用户直接输入sudo -s即可免密切换到root账号

posted @ 2018-06-16 17:41  Mr&Yu  阅读(387)  评论(0编辑  收藏  举报