#修改passwd [2 [email protected] ~]# echo "xiao3:x:888:888::/home/xiao3":/bin/ba sh >> /etc/passwd [3 [email protected] ~]# tail -1 /etc/passwd xiao3:x:888:888::/home/xiao3:/bin/bash #修改shadow [4 [email protected] ~]# grep ^troy /etc/shadow troy:$6$3OY88r6g$f.PP6oRXpgCqC0syL25dsf9FOmq0y4ZShUCw1nbVSosMo.wwsoP5OCFT.4Wpd/ZD8Ezqj/QxJDRG1n8cBIIYz/:16582:0:99999:7::: [5 [email protected] ~]# grep ^troy /etc/shadow |sed ‘s#troy#xiao3#g‘ xiao3:$6$3OY88r6g$f.PP6oRXpgCqC0syL25dsf9FOmq0y4ZShUCw1nbVSosMo.wwsoP5OCFT.4Wpd/ZD8Ezqj/QxJDRG1n8cBIIYz/:16582:0:99999:7::: [6 [email protected] ~]# grep ^troy /etc/shadow |sed ‘s#troy#xiao3#g‘ >> /etc/shadow [7 [email protected] ~]# tail -1 /etc/shadow xiao3:$6$3OY88r6g$f.PP6oRXpgCqC0syL25dsf9FOmq0y4ZShUCw1nbVSosMo.wwsoP5OCFT.4Wpd/ZD8Ezqj/QxJDRG1n8cBIIYz/:16582:0:99999:7::: #修改group [9 [email protected] ~]# echo "hougong:x:888" >> /etc/group [10 [email protected] ~]# tail -1 /etc/group hougong:x:888 #修改gshadow [12 [email protected] ~]# echo "hougong:!::" >> /etc/gshadow [13 [email protected] ~]# tail -1 /etc/gshadow hougong:!:: #复制/etc/skel文件到家目录 [17 [email protected] ~]# cp /etc/skel /home/xiao3 -R [18 [email protected] ~]# cd /home/xiao3/ [19 [email protected] xiao3]# ls README [20 [email protected] xiao3]# ll -a total 24 drwxr-xr-x 2 root root 4096 Jun 10 15:58 . drwxr-xr-x. 18 user1 root 4096 Jun 10 15:58 .. -rw-r--r-- 1 root root 18 Jun 10 15:58 .bash_logout -rw-r--r-- 1 root root 176 Jun 10 15:58 .bash_profile -rw-r--r-- 1 root root 124 Jun 10 15:58 .bashrc -rw-r--r-- 1 root root 29 Jun 10 15:58 README #改文件夹和文件权限 [33 [email protected] home]# chmod 600 -R xiao3 [34 [email protected] home]# chmod 700 xiao3 [35 [email protected] home]# ll xiao3/ total 4 -rw------- 1 root root 29 Jun 10 15:58 README [36 [email protected] home]# ll xiao3/ -a total 24 drwx------ 2 root root 4096 Jun 10 15:58 . drwxr-xr-x. 18 user1 root 4096 Jun 10 15:58 .. -rw------- 1 root root 18 Jun 10 15:58 .bash_logout -rw------- 1 root root 176 Jun 10 15:58 .bash_profile -rw------- 1 root root 124 Jun 10 15:58 .bashrc -rw------- 1 root root 29 Jun 10 15:58 README #改属主属组 [5 [email protected] home]# chown xiao3:hougong xiao3 -R #切换用户登录成功 [28 [email protected] project]$ su - xiao3 Password: [1 [email protected] ~]$
时间: 2024-10-25 07:12:46