kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

ssh使用密钥登录,禁止口令登录

http://blog.chinaunix.net/uid-8116903-id-334714.html

1、配置私钥

a、使用命令 ssh-keygen -t rsa 生成密钥

b、将公钥拷贝到远程服务器上的 /root/.ssh/authorized_keys 文件

c、客户端上保留私钥,公钥留不留都可以。也就是服务器上要有公钥,客户端上要有私钥。这样就可以实现无密码验证登录了。

2、禁止口令登录

可以修改上 /etc/ssh/sshd_conf 中的

1
2
PasswordAuthentication yes 改为
PasswordAuthentication no

也即只能使用密匙认证的openssh,禁止使用口令认证。