I've set up a SSH server which I've let some friends log into, both via SSH and FileZilla. I put a symbolic link to two hard drives in their home directories so that they could access some files. This has proved to be too difficult for some of the FileZilla (Windows) users and they keep getting lost in the filesystem.

My questions are:

  • Is it possible to make SSH users start in some other directory than their home directory? Appending "cd some_dir" to their .bashrc only works for SSH, not FileZilla.

  • Is it possible to lock the users within that directory and its subdirectories? Some users go up to / and can't find their way back, even though I keep explaining to them that they can just enter "/path/to/their/dir" in the target field.


I suggest you change the user's home to point to the destination directory. You can do that by editing /etc/passwd directly or usermod --home NEW_HOME_DIR username (this will also copy files from the previous one).

Update: As for locking, there are not many choices other than a chroot jail. If you set the login shell to /bin/rbash, it will start a restricted shell. Among other things, that means cd will not work, nor will commands that use absolute paths. Read the bash(1) man page under RESTRICTED SHELL for further details.

  • I'm not sure that is what I want. I have two hard drives mounted on /run/media/haukur/, called a and b. now if I move their home directories there, I will have several directories under /run/media/haukur/ which might confuse the users, a ls could output something like: a arnold b bob john This doesn't really solve anything since they can still get out of their home directory all the way to / and finding the relevant directories is actually harder. In any case, thanks for the reply. – Haukur Jul 2 '12 at 16:07
  • if they don't need their own unique home dirs, they can share one. – lynxlynxlynx Jul 2 '12 at 16:25
  • That would be a good solution if I could prevent the creation of .bashrc, .bash_history and other files that clutter the folder. Googling now. Thanks. – Haukur Jul 2 '12 at 16:51
  • Don't bother - you can simply delete them afterwards if they are made from "skeleton" files in /etc. It doesn't happen all the time. – lynxlynxlynx Jul 2 '12 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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