禁止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账号

猜你喜欢

转载自www.cnblogs.com/bixiaoyu/p/9190963.html