Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a ssh server. I allow people to connect to it if they want. I do my programming homework on it. I am in trouble with my teacher because people were cheating off it. I need to know how to require sudo just to access the file.

share|improve this question
add comment

2 Answers 2

Change the owner of the files to root with this command:

sudo chown root <file_name>

Then remove read permission for group (g) and other (o), like this:

sudo chmod go-r <file_name>

Tested on Debian 6 but it should work everywhere.

Here's a more complete explanation of Unix permissions, if you're interested in a more in-depth answer.

share|improve this answer
add comment

You can accomplish the same thing by changing permissions on the files, without requiring sudo. Make sure all users are in only their private user groups, then make sure the files you want to protect are in your private user group, then make sure those files do not have o+rwx permissions.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.