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'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.

share|improve this question
    
    
@uther I do not think this is a duplicate. –  Nils Jul 2 '12 at 21:02
    
Do those users need a shell, or is sftp sufficient? –  Nils Jul 2 '12 at 21:02
    
Disable direct login for normal users (like oracle) in linux but allow scp and sftp? is not an exact duplicate, but it's the method you should use unless you have a good reason not to. –  Gilles Jul 2 '12 at 21:55
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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
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.