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