sudo
是什么?
用来获取root的权限 类似于皇帝授权尚方宝剑 1个命令
让普通用户有root的权限命令
为什么要使用sudo?
1.普通用户拥有root的权限
2.安全
3.责任 日志安全

  jumpserver  py语言
    普通用户身份执行  拥有所有的root权限

  1.我如何知道我有什么权限  普通用户查看
        sudo -l 查看当前的拥有的root命令权限   
        sudo -k 清空临时缓存密码

  2.如何给普通用户授予权限
        1:直接修改配置
              /etc/sudoers
        2:使用visudo命令修改
              visudo===>vim /etc/sudoers   #语法检测功能

  3.编辑文件进行授权
        visudo
        oldboy ALL=(ALL)   /usr/bin/tailf
        User oldboy may run the following commands on oldboyedu:
     (ALL) /usr/bin/tailf
 [oldboy@oldboyedu ~]$ tailf /var/log/messages
 tailf: cannot open /var/log/messages: Permission denied		# 授予了权限 为啥不生效
  
  授权多个命令:
        oldboy ALL=(ALL)  /usr/bin/tailf,/usr/bin/vim

  授权 所有的命令
        oldboy  ALL=(ALL)   ALL
  
  对授权的命令进行取反
        oldboy  ALL=(ALL)  ALL,!/usr/bin/vim,!/usr/bin/su

  4.使用sudo命令
        [oldboy@oldboyedu ~]$ sudo tailf /var/log/messages
    Nov 13 09:10:01 oldboyedu systemd: Started Session 33 of user root.
    Nov 13 09:11:01 oldboyedu systemd: Started Session 34 of user root.


  git使用
  1.关闭selinux
    getenforce
    setenforce 0
    sed -i'7c SELINUX=disabled'/etc/selinux/config

  2.关闭firewalld防火墙  centos6防火墙服务 iptables
        systemctl stop firewalld
        systemctl disable firewalld

  3.查看当前的grit版本
        [root@oldboyedu ~]# git --version
        git version 1.8.3.1

  4.查看当前的配置
        [root@oldboyedu ~]# git config --list
        user.name=lizhenya
        user.email=lizhenya@qq.com
        color.ui=true

        [root@oldboyedu ~]# cat .gitconfig 
        [user]
            name = lizhenya
            email = lizhenya@qq.com
        [color]
            ui = true

  5.初始化目录为git仓库
        [root@oldboyedu ~]# mkdir git_data
    [root@oldboyedu ~]# cd git_data/
    [root@oldboyedu git_data]# git init

  git基础命令
        1.git init            #初始化仓库
        2.git status          #查看当前仓库的状态 保持目前仓库的干净(没有新文件 没有修改的状态)
        3.git add oldboy.txt  #把文件提交到缓存区
        4.git rm --cached oldboy.txt #删除暂存区的内容
        5.git add             #提交工作目录所有的文件到缓存区
        6.git rm              #删除工作目录的文件
        7.git checkout--file  #让暂存区的内容覆盖工作到目录的文件
        8.git rm-f a.txt      #同时删除工作区和暂存区

        git  删除文件(只要对管理的文件进行操作后 必须得git add git commit 提交 才生效)

[root@oldboyedu git_data]# git rm oldboy.txt
rm 'oldboy.txt'
[root@oldboyedu git_data]# git status

On branch master

Changes to be committed:

(use "git reset HEAD ..." to unstage)

deleted: oldboy.txt

  删除后进行提交到暂存区和本地仓库

[root@oldboyedu git_data]# git add .
[root@oldboyedu git_data]# git commit -m "delete newfile oldboy.txt"
[master c2c524e] delete newfile oldboy.txt
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 oldboy.txt

[root@oldboyedu git_data]# git checkout -- a.txt
[root@oldboyedu git_data]# ll
total 0
-rw-r--r-- 1 root root 0 Nov 13 11:50 a.txt

  改名
        [root@oldboyedu git_data]# git mv aa.txt aa.bak
        [root@oldboyedu git_data]# git add .
        [root@oldboyedu git_data]# git commit -m "modify name"


  查看文件 对比文件内容
  git diff 对比工作区和暂存区的内容
  git diff--cached  对比暂存区和本地仓库的内容