kk Blog —— 通用基础


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

git修改commit

http://blog.chinaunix.net/uid-15007890-id-3220876.html

一、修改最后一次 commit

1
git commit --amend

二、修改再之前 commit

1. 查看之前commit

1
git rebase -i master~5 //最后五次

2. 显示结果如下,把准备修改的commit前面的 pick 改为 edit ,并 :wq 保存退出

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
pick 92b4951 2009-08-08: ×××××××
pick 92b4952 2009-08-07: ×××××××
pick 92b4953 2009-08-06: ×××××××
pick 92b4954 2009-08-05: ×××××××
pick 92b4955 2009-08-04: ×××××××

# Rebase 9ef2b1f..92b495b onto 9ef2b1f
#
# Commands:
#  pick = use commit
#  edit = use commit, but stop for amending //改上面的 pick 为 edit
#  squash = use commit, but meld into previous commit
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#

3. 进行修改

1
2
git commit --amend   # 进行修改,完成后 :wq 退出
git rebase --continue # 完成操作

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,禁止使用口令认证。

ssh 新机器去掉提示yes/no

https://blog.csdn.net/wang1144/article/details/51731059

问题

每次ssh 进入一台新机器都会跳出如下的提示:

1
2
3
The authenticity of host '111.222.333.444 (111.222.333.444)' can't be established.
RSA key fingerprint is f3:cf:58:ae:71:0b:c8:04:6f:34:a3:b2:e4:1e:0c:8b.
Are you sure you want to continue connecting (yes/no)? 

解决方法

  1. 加入一个参数:
1
ssh -o "StrictHostKeyChecking no" user@host

2.修改配置文件

在文件/etc/ssh/ssh_config(全局)或者~/.ssh/config(某用户)开头加入以下内容:

1
2
3
4
5
6
7
8
Host 192.168.0.*
	StrictHostKeyChecking no
	UserKnownHostsFile=/dev/null
or

Host *
	StrictHostKeyChecking no
	UserKnownHostsFile=/dev/null