linux-Topic Exercise 1

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.