标签:su - root == 安全性 变量 ifconf pts 令行 linu 找不到
[root@cs6 ~]# chpasswd root:123456 lewen:123456 [root@cs6 ~]# #<==在新的空行输入Ctrl+D结束输入。
[root@cs6 ~]# echo stu{01..10}|xargs -n 1 useradd [root@cs6 ~]# tail /etc/passwd stu01:x:1001:1001::/home/stu01:/bin/bash stu02:x:1002:1002::/home/stu02:/bin/bash stu03:x:1003:1003::/home/stu03:/bin/bash stu04:x:1004:1004::/home/stu04:/bin/bash stu05:x:1005:1005::/home/stu05:/bin/bash stu06:x:1006:1006::/home/stu06:/bin/bash stu07:x:1007:1007::/home/stu07:/bin/bash stu08:x:1008:1008::/home/stu08:/bin/bash stu09:x:1009:1009::/home/stu09:/bin/bash stu10:x:1010:1010::/home/stu10:/bin/bash
[root@cs6 ~]# echo stu{01..10}:$((RANDOM+10000000))|tr " " "\n" >pass.txt #将空格变成换行符\n [root@cs6 ~]# cat pass.txt stu01:10027070 stu02:10027493 stu03:10013323 stu04:10023959 stu05:10001639 stu06:10003292 stu07:10018430 stu08:10012448 stu09:10022958 stu10:10011925
[root@cs6 ~]# chpasswd <pass.txt 测试所设置密码的有效性: [root@cs6 ~]# su - stu08 [stu08@cs6 ~]$ su - stu10 Password: [stu10@cs6 ~]$ whoami stu10
[lewen@cs6 ~]$ whoami lewen [lewen@cs6 ~]$ su - root Password: [root@cs6 ~]# env |egrep "USER|MAIL|PWD|LOGNAME" USER=root MAIL=/var/spool/mail/root PWD=/root LOGNAME=root
[root@cs6 ~]# taiL -1 /ete/rc.local #<==在开机启动文件/etc/rc.local中写入启动命令。 su - lewen -c ‘/bin/sh /service/scripts/deploy.sh‘
标签:su - root == 安全性 变量 ifconf pts 令行 linu 找不到
原文地址:https://www.cnblogs.com/fadewalk/p/10858698.html