linux权限999 777,linux命令权限

linux-命令权限

1)   新建用户natasha,uid为1000,gid为555,备注信息为“master”

118c64c3fe3828c800ee1244f1195c1f.png

2)   修改natasha用户的家目录为/Natasha

c027552c194ac20cca0be932c55c72b5.png

3)   查看用户信息配置文件的最后一行

32d5cc777d8adb60dd954bc207dfefe2.png

4)   为natasha用户设置密码“123”

289c60bf395618212499fcbe6778d9c4.png

5)   查看用户密码配置文件的最后一行

61043c3fad64ce24cebcdbd75423e112.png

6)   将natasha用户账户锁定

将natasha用户账户解锁

c2713be5ad5707ccb2eb84bc113bc953.png

7)   新建组police,gid为999

查看组配置文件的最后一行

278e94186db1bfd181eb3bb233148d5a.png

5e01fb8fb52ad323529d027ec08d2b4a.png

8)   将natasha用户加入police组

ded16b0b9d8e27e1828e623e22f458b1.png

9)   修改police组的组名为jingcha

069fa07f08bc813300ef10d61e454d66.png

10) 删除natasha用户,连家目录和邮箱一起删除

userdel –r natasha

11) 删除jingcha组

fe0dcbbb55a58994a3f5d5bc73798c72.png

1)  在用户的主目录下创建目录test,进入test创建空文件file1

[root@bogon ~]# mkdir test

[root@ bogon ~]# cd test/

[root@ bogon test]# touch file1

2)  以长格式形式显示文件信息,注意文件的权限和所属用户和组

[root@ bogon test]# ls -l

total 0

-rw-r--r-- 1 root root 0 Mar 15 16:24 file1

3)  为文件file1设置权限,使其他用户可以对此文件进行写操作。

[root@ bogon test]# chmod 666 file1

4)  查看设置结果,

[root@ bogon test]# ls -l

-rw-rw-rw- 1 root root 0 Mar 15 16:24 file1

5)  取消同组用户对文件file1的读取权限,并查看设置结果。

[root@ bogon test]# chmod g-w file1

[root@ bogon test]# ls -l

-rw-r--rw- 1 root root 0 Mar 15 16:24 file1

6)  用数字表示法为文件file设置权限,所有者可读、可写、可执行,所属组用户和其他用户只具有读和执行的权限。设置完成后查看设置结果。

[root@ bogon test]# chmod 755 file1

[root@ bogon test]# ls -l

-rwxr-xr-x 1 root root 0 Mar 15 16:24 file1

7)  用数字形式更改文件file1的权限,使所有者只能读取此文件。其他任何用户都没有权限。查看设置结果。

[root@ bogon test]# chmod 400 file1

[root@ bogon test]# ls -l

-r-------- 1 root root 0 Mar 15 16:24 file1

8)  回到上层目录,查看test的权限

[root@ bogon test]# cd ..

[root@ bogon ~]# ls -ld  test

drwxr-xr-x 2 root root 4096 Mar 15 16:24 test

9)  为其他用户添加对此目录的写权限

[root@ bogon ~]# chmod -R g+w test

[root@ bogon ~]# ls -ld test

drwxrwxr-x 2 root root 4096 Mar 15 16:24 test

1)以操作文件的方式,新建一个用户alex

tail -1 /etc/passwd

alex:x:1010:1010::/home/alex:/bin/bash

tail -1 /etc/shadow

alex:!!:17240:0:99999:7:::

tail -1 /etc/group

alex:x:1010:

tail -1 /etc/gshadow

alex:!::

mkdir /home/alex

cp -r /etc/skel/.[!.]* /home/alex/

chown -R alex.alex /home/alex/

touch /var/spool/mail/alex

chown -R alex.mail /var/spool/mail/alex

1) 新建目录/test/dir,属主为tom,数组为group1,/test目录的权限为777

mkdir -p /test/dir

useradd tom

groupadd group1

chown tom.group1 /test/dir

chmod 777 /test/

2) 新建用户jack,切换到jack用户下,验证jack用户对dir目录的rwx权限(开启另外一个终端,依次修改dir目录的others权限)

useradd jack

[root@bogon test]#chmod o=rw /test/dir

[root@bogon test]# ls –ld /test/dir

Drwxr-xrw-. 2 tom group1 6 3月   15  18:06 /test/dir

su - jack

2beb982e7680341902bb9d70106130a9.png

3)将jack加入group1组,验证jack用户对dir目录的rwx权限(开启另外一个终端,依次修改dir目录的group权限

a93b85afd84d0e1bfa392961d0b8f94e.png

4)切换到tom用户,验证tom用户对dir目录的rwx权限(开启另外一个终端,依次修改dir目录的user权限)

5)在dir目录内新建文件tom.txt,属主为tom,属组为group1,/test目录的权限为777

[root@bogon dir]# chown tom.group1 tom.txt

[root@bogo dir]# chmod 777 tom.txt

[root@bogo dir]# ls -l tom.txt

-rwxrwxrwx 1 tom group1 11 Mar 15 17:27 tom.txt

6)新建用户rose,切换到rose用户下,验证rose用户对tom.txt的rwx权限(开启另外一个终端,依次修改tom.txt的others权限来配合验证过程)

(1)rwx权限

[rose@bogo dir]$ ls -l tom.txt

-rwxrwxrwx 1 tom group1 11 Mar 15 17:27 tom.txt

[rose@bogo dir]$ cat tom.txt

echo "tom"

[rose@bogo dir]$ vim tom.txt

(2)rw权限

[root@bogo dir]# chmod 776 tom.txt

[root@bogo dir]# ls -l tom.txt

-rwxrwxrw- 1 tom group1 12 Mar 15 17:31 tom.txt

7)将rose加入group1组,在rose用户下,验证rose用户对tom.txt的rwx权限(开启另外一个终端,依次修改tom.txt的group1权限来配合验证过程)

8)切换到tom用户,验证tom用户对tom.txt的rwx权限(开启另外一个终端,依次修改tom.txt的user权限来配合验证过程)

9。linux 下查看当前用户

使用who命令可以查看当前登录用户,使用w命令可以看到所有登录用户信息。

1、命令who

显示当前登录用户,登录时间和登录IP地址。参考下图

8217cb2fdbe4f61c49d95bb6f531e491.png

2、命令w

按照标题显示:当前时间、机器运行时间、登录用户数量、系统负载信息。

2f7b5af2e72f6a82aca19f5dbbcf5c2e.png

10.分派IP地址:

[root@bogon /]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

TYPE=Ethernet

BOOTPROTO=static

DEVICE=eth0

IPADDR=

xuaijun-p-6556026.html192.168.2.4 

NETMASK=

xuaijun-p-6556026.html255.255.255.0 

GATEWAY=

xuaijun-p-6556026.html192.168.2.10 

ONBOOT=yes

11.Centos修改root密码

[root@localhost ~]# passwd

Changing password for user root.

New password:

Retype new password:

passwd: all authentication tokens updated successfully.

11.直接把包拉到虚拟机(yum install  lrzsz)

12.

#Linux:

#建文件:

# touch /tep/a.txt

#动态监测文件变化:

#tail -f /tep/a.txt

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值