subject

Write a C program that will allow you to add messages to a file that has NO permissions for any user. A Unix system has many files that have sensitive information in them. Permissions help keep these files secure. Some files can be publicly read, but can not be altered by a regular user (ex.: /etc/passwd). Other files can't be read at all by a regular user (ex.: /etc/shadow). The program you develop should take a message given as a command line argument and append it to a file (also specified on the command line). The file should have no permissions, both before and after the message is appended. Of course, the file should be owned by you. Your program should also have a -c option that will clear the file before the message is appended. Algorithm Check to see if the output file exists. If it doesn't, create it. Life is simpler if a newly created file is closed at the end of this step. Check the permissions of the output file. If any permissions exist, print a useful error message and exit. Change the permissions on the file to allow writing by the user. Open the file for output. If the "-c" command line option is present, make sure the file is truncated. Write the message from the command line to the output file. Write an additional newline character so that the output has a nicer format.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 10:50
In 2009 to 2010, how many social network users were reported as being victims of online abuse? a. 1 in 10 b. 100% c.1 in 100 d. 50%
Answers: 2
question
Computers and Technology, 26.06.2019 02:30
Technician a says underinflation of a tire causes excessive one-sided wear on one side of the tread. technician b says overinflation of a tire causes excessive wear on the center portion of the tread. who is correct? tech a tech b both tech a and b neither tech a and b
Answers: 1
question
Computers and Technology, 26.06.2019 05:30
If you could create a social network, what would it be like? what would make it so special about the others? (if you want you can name it)
Answers: 1
question
Computers and Technology, 26.06.2019 07:00
What's better: a) ps4 b) pc c) xbox one d) nintendo switch
Answers: 2
You know the right answer?
Write a C program that will allow you to add messages to a file that has NO permissions for any user...
Questions