Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

Your Answer


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.