1. 755-》对应什么权限:rwxr-xr-x ,所属用户有读、写、执行权限,所属组有读、执行权限,其他用户有读、执行权限
    600-》对象什么权限:rw-------,所属用户有读、写权限,所属组和其他用户无任何权限
    644-》对应什么权限:rw-r–r–,所属用户有读、写权限,所属组和其他用户有只读权限
    1666-> 对应什么权限:rw-rw-rwT,所属用户有读、写权限,所属组有读、写权限,其他用户有读、写权限、无删除文件权限
    7777-> 对应什么权限:rwsrwsrwt,所属用户,所属组和其他用户均有读、写、执行权限,且其他用户在执行此文件时,拥有本文件的所属用户和所属组的权限,其他用户无法删除文件
    6000-> 对应什么权限:–S–S—,所属用户,所属组,其他用户都无任何权限,其他用户在执行此文件时,拥有本文件的所属用户和所属组的权限

1).创建文件,并赋予权限611(两种方式,一种guoa,一种nnn)

[root@ww test]# touch file11
[root@ww test]# ls -l file11
-rw-r--r--. 1 root root 0 Apr  9 18:37 file11
[root@ww test]# chmod 611 file11
[root@ww test]# ls -l file11
-rw---x--x. 1 root root 0 Apr  9 18:37 file11
[root@ww test]# chmod u=rw file11
[root@ww test]# chmod g=x file11
[root@ww test]# chmod o=x file11
[root@ww test]# ls -l file11
-rw---x--x. 1 root root 0 Apr  9 18:37 file11

2).创建目录,并赋予权限755(两种方式,一种guoa,一种nnn)

[root@ww test]# mkdir chmod
[root@ww test]# chmod 755 chmod
[root@ww test]# chmod u=rwx chmod
[root@ww test]# chmod g=rx chmod
[root@ww test]# chmod o=rx chmod
[root@ww test]# ls -dl chmod
drwxr-xr-x. 2 root root 6 Apr  9 18:59 chmod

3).创建文件,并将文件的属主和属组修改其他用户

[root@ww test]# touch file12
[root@ww test]# ls -l file12
-rw-r--r--. 1 root root 0 Apr  9 19:03 file12
[root@ww test]# chown ww:ww file12
[root@ww test]# ls -l file12
-rw-r--r--. 1 ww ww 0 Apr  9 19:03 file12

4).设置suid,为文件设置suid(两种方式 u+s和nnnn)的方式

[root@ww test]# chmod u+s file11
[root@ww test]# ls -l file11
-rwS--x--x. 1 root root 0 Apr  9 18:37 file11
[root@ww test]# chmod 4644 file12
[root@ww test]# ls -l file12
-rwSr--r--. 1 ww ww 0 Apr  9 19:03 file12

5).设置sgid, 为文件设置sgid(两种方式 g+s和nnnn)的方式

[root@ww test]# chmod g+s file11
[root@ww test]# ls -l file11
-rwS--s--x. 1 root root 0 Apr  9 18:37 file11
[root@ww test]# chmod 6644 file12
[root@ww test]# ls -l file12
-rwSr-Sr--. 1 ww ww 0 Apr  9 19:03 file12

6).设置sbit,为目录设置sbit(两种方式 o+t和nnnn)的方式

[root@ww test]# ls -dl chmod
drwxr-xr-x. 2 root root 6 Apr  9 18:59 chmod
[root@ww test]# chmod o+t chmod
[root@ww test]# ls -dl chmod
drwxr-xr-t. 2 root root 6 Apr  9 18:59 chmod
[root@ww test]# mkdir chmod1
[root@ww test]# ls -dl chmod1
drwxr-xr-x. 2 root root 6 Apr  9 19:11 chmod1
[root@ww test]# chmod 1755 chmod1
[root@ww test]# ls -dl chmod1
drwxr-xr-t. 2 root root 6 Apr  9 19:11 chmod1

7).创建文件,查询文件的acl
为文件设置acl 用户为ww 权限为 rwx
为文件设置acl的mask: 权限为r-x

[root@ww test]# getfacl file11
# file: file11
# owner: root
# group: root
# flags: ss-
user::rw-
group::--x
other::--x[root@ww test]# ls -l file11
-rwS--s--x. 1 root root 0 Apr  9 18:37 file11
[root@ww test]# setfacl -m u:ww:rwx file11
[root@ww test]# ls -l file11
-rwSrws--x+ 1 root root 0 Apr  9 18:37 file11
[root@ww test]# getfacl file11
# file: file11
# owner: root
# group: root
# flags: ss-
user::rw-
user:ww:rwx
group::--x
mask::rwx
other::--x
[root@ww test]# setfacl -m m:rx file11
[root@ww test]# getfacl file11
# file: file11
# owner: root
# group: root
# flags: ss-
user::rw-
user:ww:rwx         #effective:r-x
group::--x
mask::r-x
other::--x

1).查询ip的几种方式: ip, ifconfig, nmcli,nmtui
ip a:

[root@ww test]# ip a
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000link/ether 00:0c:29:5e:61:61 brd ff:ff:ff:ff:ff:ffinet 192.168.178.128/24 brd 192.168.178.255 scope global dynamic noprefixroute ens160valid_lft 1298sec preferred_lft 1298secinet6 fe80::9d7c:229c:e5e9:aac1/64 scope link noprefixroute valid_lft forever preferred_lft forever

ifconfig:

[root@ww test]# ifconfig
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500inet 192.168.178.128  netmask 255.255.255.0  broadcast 192.168.178.255inet6 fe80::9d7c:229c:e5e9:aac1  prefixlen 64  scopeid 0x20<link>ether 00:0c:29:5e:61:61  txqueuelen 1000  (Ethernet)RX packets 5449  bytes 3086175 (2.9 MiB)RX errors 0  dropped 0  overruns 0  frame 0TX packets 3195  bytes 245848 (240.0 KiB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

nmcli:

[root@ww test]# nmcli
ens160: connected to ens160"VMware VMXNET3"ethernet (vmxnet3), 00:0C:29:5E:61:61, hw, >ip4 defaultinet4 192.168.178.128/24route4 0.0.0.0/0route4 192.168.178.0/24inet6 fe80::9d7c:229c:e5e9:aac1/64route6 fe80::/64route6 ff00::/8

nmtui:

2).nmcli命令使用:
a.在ens160网卡上新建连接static_con,并配置静态ip

[root@ww test]# nmcli connection add type ethernet con-name static_con ifname ens160 ipv4.addresses 192.168.178.129/24 ipv4.gateway 192.168.178.2 ipv4.method manual ipv4.dns 8.8.8.8 autoconnect yes
Warning: There is another connection with the name 'static_con'. Reference the connection by its uuid 'ae07a3c9-3efc-4f17-b434-82a16c9e4caa'
Connection 'static_con' (ae07a3c9-3efc-4f17-b434-82a16c9e4caa) successfully added.

b.在ens160网卡上新建连接auto_con, 配置动态ip

[root@ww test]# nmcli connection add type ethernet con-name auto_con ifname ens160 ipv4.method auto
Connection 'auto_con' (dccfd933-4116-4a2b-a7cf-f4dbacb31760) successfully added.

c.修改static_con的ip的方式: nmtui,nmcli c modify, nmcli c edit, 修改配置文件
nmtui:

nmcli c modify:

[root@ww test]# nmcli c modify static_con ipv4.addr '192.168.178.129/24'

nmcli c edit:

[root@ww test]# nmcli c edit static_con ===| nmcli interactive connection editor |===Editing existing '802-3-ethernet' connection: 'static_con'Type 'help' or '?' for available commands.
Type 'print' to show all the connection properties.
Type 'describe [<setting>.<prop>]' for detailed property description.You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, dcb, sriov, ethtool, match, ipv4, ipv6, tc, proxy
nmcli> goto ipv4.addresses
nmcli ipv4.addresses> change
Edit 'addresses' value: 192.168.178.130/24
Do you also want to set 'ipv4.method' to 'manual'? [yes]: yes
nmcli ipv4.addresses> back
nmcli ipv4> save
Connection 'static_con' (924e8830-0140-4192-984d-912b42858f12) successfully updated.
nmcli ipv4> quit

修改配置文件:

[root@ww network-scripts]# vim ifcfg-static_con
IPADDR2=192.168.178.129
PREFIX=24

d.激活static_con的方式: up, reapply, reload, load

[root@ww network-scripts]# nmcli c reload

e.删除static_con

[root@ww network-scripts]# nmcli c del static_con
Connection 'static_con' (924e8830-0140-4192-984d-912b42858f12) successfully deleted.

f.添加一个网卡,并查看设备状态

[root@ww network-scripts]# nmcli d
DEVICE      TYPE      STATE         CONNECTION
ens160      ethernet  connected     ens160
virbr0      bridge    connected     virbr0
ens224      ethernet  disconnected  --
lo          loopback  unmanaged     --
virbr0-nic  tun       unmanaged     --

h:如果是connected,断开连接

[root@ww network-scripts]# nmcli d disconnect ens224
Device 'ens224' successfully disconnected.

i:将断开的网卡状态设为connected

[root@ww network-scripts]# nmcli d connect ens224
Device 'ens224' successfully activated with '27018877-beea-4fc6-af82-178a790baef1'.
[root@ww network-scripts]# nmcli d
DEVICE      TYPE      STATE      CONNECTION
ens160      ethernet  connected  ens160
ens224      ethernet  connected  ens224
virbr0      bridge    connected  virbr0
lo          loopback  unmanaged  --
virbr0-nic  tun       unmanaged  --

4.停止ens224连接(记得在Vmware上操作,因为停止ens160后,远程连接断掉)

删除ens224连接

[root@ww network-scripts]# nmcli c delete ens224
Connection 'ens224' (27018877-beea-4fc6-af82-178a790

查看所有连接

[root@ww network-scripts]# nmcli c
NAME      UUID                                  TYPE      DEVICE
ens160    f2152c59-7800-4e86-b1a9-ce62a0c7590a  ethernet  ens160
virbr0    40475724-d97d-4ac6-9452-7f91901eae51  bridge    virbr0
auto_con  dccfd933-4116-4a2b-a7cf-f4dbacb31760  ethernet  --

查看所有设备

[root@ww network-scripts]# nmcli d
DEVICE      TYPE      STATE         CONNECTION
ens160      ethernet  connected     ens160
virbr0      bridge    connected     virbr0
ens224      ethernet  disconnected  --
lo          loopback  unmanaged     --
virbr0-nic  tun       unmanaged     --

创建静态IP连接

[root@ww network-scripts]# nmcli connection add type ethernet con-name static_con ifname ens160 ipv4.addresses 192.168.178.129/24 ipv4.gateway 192.168.178.2 ipv4.method manual ipv4.dns 8.8.8.8 autoconnect yes
[root@ww network-scripts]# nmcli c
NAME        UUID                                  TYPE      DEVICE
ens160      f2152c59-7800-4e86-b1a9-ce62a0c7590a  ethernet  ens160
virbr0      40475724-d97d-4ac6-9452-7f91901eae51  bridge    virbr0
auto_con    dccfd933-4116-4a2b-a7cf-f4dbacb31760  ethernet  --
static_con  c39e2aee-e999-46c3-877a-58d940dc0179  ethernet  --
[root@ww network-scripts]# nmcli c show static_con
ipv4.addresses:                         192.168.178.129/24
ipv4.gateway:                           192.168.178.2

启动连接

[root@ww network-scripts]# nmcli c up static_con

使连接生效的三种方式

[root@ww ~]# nmcli c up ens160

[root@ww ~]# nmcli d reapply ens160
Connection successfully reapplied to device 'ens160'.

[root@ww ~]# nmcli d connect ens160
Device 'ens160' successfully activated with 'f2152c59-7800-4e86-b1a9-ce62a0c7590a'.

查看创建连接所产生的配置文件

[root@ww ~]# cd /etc/sysconfig/network-scripts/
[root@ww network-scripts]# ls
ifcfg-auto_con  ifcfg-ens160  ifcfg-static_con

修改IP,在原先ip的基础上+10=》 比如:原IP为:192.168.233.128 =》 192.168.233.138

[root@ww network-scripts]# nmcli c modify ens160 ipv4.addr '192.168.178.138/24'
[root@ww network-scripts]# nmcli c show ens160
ipv4.addresses:                         192.168.178.138/24

Day6:Linux中文件权限及网络设置相关推荐

  1. linux文件目录含义,Linux中文件权限目录权限的意义及权限对文件目录的意义

    linux中目录与文件权限的意义 一.文件权限的意义 r:可以读这个文件的具体内容: w:可以编辑这个文件的内容,包括增加删除文件的具体内容: x:文件就具有了可执行的权限-------注意:这里和w ...

  2. linux中文件权限 组,linux中文件权限格式与chmod命令以及用户和用户组的管理

    简单了解一下linux中的文件权限格式与chmod命令 chmod命令:改变文件或者目录的权限 格式:chmod [参数] [] -R 或者--recursive 递归处理,表示将指定目录下的所有文件 ...

  3. 关于Linux中文件权限的探究

    1.文件权限相关 Linux 里的每个文件都有三种属性,允许用户控制文件的访问者和访问方式,用户所有者.拥有组和其他人权限.当用户创建一个文件,这个用户就是这个文件的拥有人(通常),这个用户的组也成为 ...

  4. Linux中文件权限的一些知识

    为什么80%的码农都做不了架构师?>>>    读<Linux命令行和shell脚本编程大全>,想起来在入侵中一些Linux文件权限的一些问题,简单记一下要点: umas ...

  5. Linux的文件权限与目录设置

    1.在默认情况下,系统上的账号与一般身份用户还有root相关文件信息都是记录在 /etc/passwd 这个文件内.至于个人密码则是记录在 /etc/shadow这个文件下,此外,Linux所有的组名 ...

  6. Linux中文件权限查看和修改

    权限定义 linux文件权限分为:r读权限(4).w写权限(2).x执行权限(1) linux权限对象分为:拥有者.组用户.其他用户 权限修改: chown user:group /usr/local ...

  7. Linux中文件权限、所有者、所属组修改

    目录 一.chmod(修改文件权限) 1.符号设定法 2.数字设定法(用三位八进制数字表示) 二.chown(修改文件所有者和所属组) 1.修改文件所有者 2.修改文件所有者和所属组 三.chgrp修 ...

  8. 2对应字母权限Linux,linux中文件权限的字母含义

    一.文件系统部分 - 普通文件(文本文件,二进制文件,压缩文件,电影,图片...) d 目录文件(蓝色) b 设备文件(块设备)存储设备硬盘,U盘 /dev/sda, /dev/sda1 c 设备文件 ...

  9. linux中文件链接,关于Linux中文件,链接的一些思考

    在Unix系统中,操作系统为磁盘上的文本与图像,鼠标键盘操作,网络交互等IO操作设计了一组通用API. 使他们被处理的时候可统一用字节流的方式.所以说,除了进程之外,其他的一切均可看做文件. Linu ...

最新文章

  1. 百万人学AI:CSDN重磅共建人工智能技术新生态
  2. 大数据分布式集群搭建(1)
  3. BIEE物理业务层编辑之后发布路径
  4. Android ProGuard使用要点!
  5. USACO 3.2 Stringsobits(DP)
  6. 【模板】可持久化线段树 1(主席树)
  7. 昨天日志 今天日志的获取方法
  8. javaweb学习总结(十)——HttpServletRequest对象(一)(转)
  9. 西湖大学最年轻博导来了丨93年出生的他,想创造属于中国的“追光”纪录
  10. 求最大公约数——欧几里得算法(JAVA)
  11. java for循环前面label_Java 实例
  12. springboot转发http请求_如何实现Http请求报头的自动转发
  13. 给你的网站添加3D地球显示的访客统计(使用RevolverMaps)
  14. 《软技能:代码之外的生存指南》一一35.2 找出你的短板
  15. 递归实现斐波那契数列(Java)
  16. 程序员面试的注意事项(一):面试的流程
  17. win 10 显示未识别网络的 一种解决办法
  18. Firewalld ip伪装和端口转发
  19. 关爱残障儿童,天使之翼爱心活动进行
  20. 在office2016中,安装mathtype6.9后出现的dll文件缺失问题

热门文章

  1. [ CSS ] line-height 与垂直居中!
  2. 千文详解:十分钟带你深入了解华为交换机的通信原理
  3. “千年老二”Bing要翻身?
  4. 2022 上半年小程序白皮书新鲜出炉,「四维开放」促进小程序更强劲的场景触达
  5. 提取VirusTotal的扫描结果
  6. 高中计算机课总结300字,网课总结作文300字
  7. 用R语言实现卡方检验
  8. 基于MATLAB坐标转换程序设计,基于Matlab的坐标转换程序设计
  9. 解决ssh连接慢,挂起在SSH2_MSG_SERVICE_ACCEPT信息之后很久的问题
  10. pycharm上传更新内容至linux服务器