第1章 Linux系统

1.命令 +

2.添加用户

3.selinux iptables关闭

4.显示中文 乱码如何解决

 

查看系统版本

[root@oldboyedu-40 ~]# cat /etc/redhat-release

CentOS release 6.9 (Final)

[root@oldboyedu-40 ~]# uname -r

2.6.32-696.el6.x86_64

[root@oldboyedu-40 ~]# uname -m

x86_64

 

1.1 在系统中创建或添加用户:useradd +用户名

修改设置密码:password +密码

切换用户:su - 用户名

显示你是谁:whoami

 

18日

 

 

关闭防火墙selinux

关闭防火墙iptables

linux显示中文乱码如何解决

第2章 一.关闭SELinux功能  限制用户权限用的  美国国家安全局

enforcing     selinux默认状态 selinux已经开启 正在运行

permissive    selinux临时关闭 显示警告

disabled      selinux彻底关闭

 

方法:

第一个里程碑-永久关闭selinux  修改selinux的配置文件

 

   

 

[root@oldboyedu ~]# cat /etc/selinux/config

 

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=enforcing

# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

 

 

[root@oldboyedu ~]# sed 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config

 

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

 

 

[root@oldboyedu ~]# sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config

[root@oldboyedu ~]# cat /etc/selinux/config

 

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

 

[root@oldboy40 ~]# grep "SELINUX=" /etc/selinux/config

# SELINUX= can take one of these three values:

SELINUX=disabled

 

 

selinux配置文件如果想要生效 需要重启

不要给自己找任何理由重启服务器

 

第2个里程碑-临时关闭selinux

查看selinux是否正在运行 selinux状态

命令getenforce

enforceing 

enforceing  selinux正在运行

[root@oldboyedu ~]# ###查看selinux是否正在运行 selinux状态

[root@oldboyedu ~]# getenforce

Enforcing

[root@oldboyedu ~]# #Enforcing selinux正在运行

[root@oldboyedu ~]#

[root@oldboyedu ~]# ##临时关闭selinux

[root@oldboyedu ~]# setenforce

usage:  setenforce [ Enforcing | Permissive | 1 | 0 ]

[root@oldboyedu ~]# setenforce 0

[root@oldboyedu ~]# getenforce

Permissive

 

 

 

第3章 二、关闭防火墙iptables

防火墙------我们大楼的保安 门卫

3.1工作中如何使用 何时开启关闭 防火墙

大楼的门口 所有人都可以进进出出

内部的教室的门 内部人员 学生 老师 出入 不开启防火墙

刚开始学习Linux 的时候 也要关闭防火墙

 

2.2查询防火墙是否在运行

[root@oldboyedu ~]# /etc/init.d/iptables status

Table: filter

Chain INPUT (policy ACCEPT)

num  target     prot opt source               destination        

1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED

2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0          

3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0          

4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22

5    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

 

Chain FORWARD (policy ACCEPT)

num  target     prot opt source               destination        

1    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

 

Chain OUTPUT (policy ACCEPT)

num  target     prot opt source               destination      

 

2.3临时关闭防火墙

[root@oldboyedu ~]# /etc/init.d/iptables stop

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:                               [  OK  ]

[root@oldboyedu ~]# /etc/init.d/iptables stop

[root@oldboyedu ~]#

[root@oldboyedu ~]# /etc/init.d/iptables status

iptables: Firewall is not running.

2.4永久关闭iptables

计算机重启 红蜘蛛 安全软件是否还会关闭?

计算机 开机的时候自动运行/启动软件 开机自动启动

 

让iptables防火墙 再开机的时候不启动

chkconfig 管理软件是否在开机的时候自动启动 管理开机自动启动的软件

查看防火墙是否在运行

chkconfig |grep ipt

关闭防火墙

chkconfig iptables off

 

 

 

第4章 三.Linux显示中文乱码如何解决(如何防止)

4.1什么是字符集?

字符集 GBK国内的 UTF-8国际 基本每个国家都可以显示出来

常用字符集 UTF-8

 

4.2如何查看字符集 变量中?

变量

x+y=10

x y 未知数-----变量

x变量

    变量的名字         ====== 藏经阁武功秘籍的名字 书名 葵花宝典

      查看变量里面的内容 ====== 阅读武功秘籍     读书   $x

    修改变量里面的内容 ====== 给书添加新的内容        x =新的内容 *****

 

     

4.3如何修改系统的字符集

     

4.3.1查看当前系统适用的字符集

1.名字大写

2.在系统中 大部分角落 都可以使用

 

[root@oldboyedu ~]# echo $LANG

en_US.UTF-8

 

4.3.2临时修改系统语言改成中文的

[root@oldboyedu ~]# export LANG=zh_CN.UTF-8

4.3.3永久修改系统语言改成中文的

cat /etc/sysconfig/i18n

LANG="en_US.UTF-8"

SYSFONT=“latarcyrheb-sun16”

生效:

source /ext/sysconfig/i18n

 

4.4显示中文乱码的原因:

解决过程:

4.1.1.1  检查系统的字符集

第一个里程碑-查看当前系统的字符集 :echo $LANG

第二个里程碑-查看软件的字符集:

4.1.1.2  解决 :

修改xshell/SecureCRT/Putty软件字符集

修改linux系统的字符集

临时(命令行命令):export LANG=en_US.utf8

永久:把上面的内容LANG=en_US.utf8 放入到/etc/sysconfig/i18n

生效:source或. /etc/sysconfig/i18n

posted on 2017-11-16 19:31  李烨然  阅读(92)  评论(0)    收藏  举报