Hello, I’m JackTian.

Today, a reader wrote to me to help me look at some basic exam questions. This question is too simple to be honest. Simple things are decided not to be complicated, and it is simply not presented by writing scripts.

Without further ado, let’s get to the point.


1. Check the permission of the /etc/filesystems file. The current permission of the /home/network/studentl file is rw-r – -. Change the permission to rwxrw-r – -. Example Set the permission of the /opt/computer directory to 755.

ls -l /etc/filesystems | awk '{print $1}'
chmod 764 /home/network/studentl
chmod 755 /opt/computer
Copy the code

Create a user group named networks (GID = 530), rename the networks user group to teach user group, rename the teacher user group to 506, delete the teacher user group.

groupadd -g 530 networks
groupmod -n teach networks
groupmod -g 506 teacher
groupdel teacher
Copy the code

Create user name Student, home directory /opt/, Shell /sbin/nologin, UID / 666, create user name Student, name jack, and home directory jack

useradd student -m -d /opt/student -s /sbin/nologin -u Awesome!
grep student /etc/passwd
usermod -l jack student
userdel -r jack
Copy the code

4. Create subdirectories user1, user2 and user3 in the root directory. Use the touch command to create test files in the corresponding directories, named user1. TXT, user2. TXT and user3. TXT. Copy the /user/user1/user1. TXT file to the/MNT directory and delete the /user/user3 subdirectory

mkdir -p /user/{user1,user2,user3}
touch /user/user1/user1.txt /user/user2/user2.txt /user/user3/user3.txt
mv /user/user1/user1.txt /mnt
rm -rf /user/user3
Copy the code

That’s all for today;


Original is not easy, if you think this article is useful to you, please kindly like, comment or forward this article, because this will be my power to output more high-quality articles, thank you!

By the way, be sure to give me some free attention, nuggets! In case you get lost and don’t find me next time.

See you next time!