Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 would like everyone's to have a folder in the home directory to accessible over the internet w/ password protected. I would also like to limit how much everyone can have in the home folder.

When they ssh on to the machine they also are only limited to viewing there files, and can see nothing beyond their home directory.

I am setting up a server for some students doing some coding and sharing of files. I would appreciate any help with this.

Please and thank you.

share|improve this question
It is worth thinking about whether or not the student would gain something if everybody's home would be accessible to all. My university provides such a server, and everybody can read anything on it. Very convenient! Also, since Linux does fair scheduling, I can use it to do my hefty calculations over night without bothering anybody. – Stefano Palazzo Oct 27 '10 at 10:32
up vote 5 down vote accepted

First of all, you should use key-based authentication for ssh, not password based. They need to learn how to do proper security from the start...

OpenSSH has the option to chroot users into their home directory, that should keep the students inside their own $HOME. Alternatively, you can use permissions / umask to restrict access to other student's $HOME.

More might/will be needed depending on what sort of development they need to do...

share|improve this answer
+1 for chrooting SSH. It's a MASSIVE pain to set up (IME) but it's well worth it for security. – Oli Oct 27 '10 at 10:02
links? places to look? – myusuf3 Oct 27 '10 at 15:05

chroots are a little bit overkill given the parameters.

Simply setting the user's home dirs to 700 permissions, or more specifically "only the owner can do anything in the directory" will be sufficient. If you're worried about them knowing that eachother exist with ls /home you can go further and create a /home/students dir which is root owned and perms rwx--x--x and create the users inside of that.

Edit /etc/adduser.conf to set the DIR_MODE=0700, and DHOME=xxx to set the default home prefix.

Agreed with the person earlier who said that you should enforce SSH keys only for access to this machine. Rather than giving them a one time password, you should ask them to generate an ssh public key and give it to you via email.

ssh-keygen -t rsa -b 2048

Should be sufficient and will work on Linux and Mac. If they are on windows, PuTTY has a good tutorial for setting up ssh keys. After that command, they should send you ~/.ssh/ only.

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.