2

I have a directory called /home/user1. In this directory, is a counter-strike game server that requires the permissions of the folder and all the files in it to be user1 rwe (read, write, execute).

What I am trying to do is set up debian's SFTP server, and jail user1 to user1's directory.

However the game server's permissions requirements are getting in the way.

Both vsftpd and sshd state that root permissions must set on the directories you wish to jail. Therefore when I set the directory /home/user1 and all the files it contains to ownership by root, the game server doesn't start. But when I set the /home/user1 directory and all the files in it to user1 rwe permissions, the sftpd and sshd servers disconnnect in filezilla with the following message:

Response:   500 OOPS: vsftpd: refusing to run with writable root inside chroot()

Error: Critical error: Could not connect to server

Now I can give user1 chroot permissions in the ftp accounts, but then they are free to roam the server and this is not desirable.

What I need to do is give user1 rwe permissions in vsftpd or sshd, that are jailed to the /home/user1 directory.

In addition I would also like admin to be jailed to the home directory as well, but be able to manage game servers in /home/user1, /home/user2, /home/user3 directories with rwe permissions.

0

First of all, execute permissions have an x bit, not an e one ;-)

It would appear that it is not possible to create a directory which is only writable by root (as required for a chroot jail) and at the same time writable by the user who will be running processes in that directory (as required for your game server). Therefore, what you want to do is not possible as per your problem statement.

However, you can do the following instead:

drwxr-xr-x 5 root  root  /home/jaildir
drwxr-xr-x 5 user1 user1 /home/jaildir/user1

set the home directory of user1 to be /home/jaildir/user1, and set the chroot jail in vsftpd to be /home/jaildir. The only downside of this method is that the ftp root will be one level above the actual "interesting" content.

  • Not possible in linux -surely not x)! Ok so put the server in /home/jaildir/user1 and set the chroot jail in vsftpd to be /home/jaildir? What's the command to successfully chroot jail in vsftpd -I ask because I tried quite a few solutions and no matter what, when I chroot'd user1, I had access to the entire server from that account. – Ace Thanks Oct 6 '16 at 9:51

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.