1. Create a group testgroup;2, create a user a2012, first create it with the default settings, and then add the user to the Testgroup group. 3, create user a2013, its owner directory is/tmp/a2013, its main group is Testgroup, additional group is users. 4. Use the ID command to display a2012 and a2013 user information, and record this information in the log file/tmp/test.log. 5, reference book 98-99 page crontab command content, use ROOT to perform crontab-e, write the time table, complete every 5 minutes to append the current time into the/tmp/test.log. 6, the implementation of CRONTAB-L, the output is appended into the/tmp/test.log. 7, to complete 2 times when the record is appended, execute crontab-r delete the current schedule table. 8, copy the/tmp/test.log to Windows (note the conversion of text format), open with Notepad to see if the full content.
the way I do it
Linux Environment: CentOS 6.8
1, create group Testgroup;
Groupadd Testgroup
2, create the user a2012, first created with the default settings, and then let the user join the Testgroup group.
Useradd a2012
Usermod-g Testgroup a2012
3, create user a2013, its owner directory is/tmp/a2013, its main group is Testgroup, additional group is users.
Useradd-d/tmp/a2013/-G testgroup-g users a2013
Problems encountered here Useradd:cannot set SELinux context for home directory
The correct is:
Semanage fcontext-a-e/home/tmp/new_home
Mkdir/tmp/new_home
Restorecon/tmp/new_home
useradd-d/tmp/new_home/tester Tester
I verified that it works fine the this.
Re-run the problem: semanage command not found
Problem solving:yum-y install policycoreutils-python.x86_64
4. Use the ID command to display a2012 and a2013 user information, and record this information in the log file/tmp/test.log.
Id-u a2012 >>/tmp/test.log
Id-u a2013 >>/tmp/test.log
5, reference book 98-99 page crontab command content, use ROOT to perform crontab-e, write the time table, complete every 5 minutes to append the current time into the/tmp/test.log.
Crontab-e
0-59/5 * * * * date-u >>/tmp/test.log
6, the implementation of CRONTAB-L, the output is appended into the/tmp/test.log.
Crontab-l >>/tmp/test.log
7, to complete 2 times when the record is appended, execute crontab-r delete the current schedule table.
8, copy the/tmp/test.log to Windows (note the conversion of text format), open with Notepad to see if the full content.
I can open it with notepad++.
linux-Topic Exercise 1