Login ssh - jail under main directory

Discussion in 'General' started by pinkfeet, Jul 29, 2014.

  1. pinkfeet

    pinkfeet New Member HowtoForge Supporter

    Hi,

    I would like to enable that customers can create new user shells with jail under his main directory. If I create new users shell with option "NONE", the user is created succesfully but this user can login without problem but he can move until / or another directory without problems. However, if I create it as "Jailkit", user is created without problem too but his path is one directory empty.

    I would like to create ssh users with /home/ under his own website. Example, if user web59 has as home -> /var/www/web59/ his new ssh users has /var/www/web59 too (as Jail of course)

    Is it possible?

    Thanks
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The home of jailed users is /var/www/web59/home/username. Using /var/www/web59/ will not work as /var/www/web59/ is already / of the jailed account.
     
  3. pinkfeet

    pinkfeet New Member HowtoForge Supporter

    Thanks Till but are there way that users can be jailed into main directory? /var/www/web59/

    I want they can list content, create files using SSH or FTP
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Users are jailed to the main directory when you create a jailed user.

    A jail means that the / of the logged in user is move downwards in the directory hierachy. so /var/www/web59/ is / for this user. Like on any Unix like system, the user has its home directory and after logging in by sh, he is in his home directory. So his home is /var/www/web59/home/username and the logged in user sees this just as /home/username. So the jailed login is exactly the same as a normal login for a jailed user and he is in the same directory from his point of view.
     
  5. pinkfeet

    pinkfeet New Member HowtoForge Supporter

    Hi Till,

    Its correct, I created an username and I can move around my main directory and I can see my web using SSH (its solved, thanks).
    By other way, and as this question is regardind same task, how could I create file or directory with this user inside my home? I explain:

    username: aarango
    [email protected]:/$ ls -alh
    drwx--x--x 23 aarango client44 4.0K Jul 31 09:41 web

    [email protected]:/$ cd web
    [email protected]:/web$ touch test
    touch: setting times of `test': Permission denied

    I wonder if I could create files or directory with this new user,

    Thanks again for support.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    You should be able to create a file in /web with that user as it has the same uid then the user that owns this folder.

    I just tested iton my server and it works fine:

    Code:
    [email protected]:~$ cd ../../
    [email protected]:/$ ls
    bin  cgi-bin  dev  etc  home  lib  lib64  log  private  run  ssl  tmp  usr  var  web  webdav
    [email protected]:/$ cd web
    [email protected]:/web$ touch test
    [email protected]:/web$
    maybe you tested a lot in this website and something got broken or you changed any folder permissions or ownerships.
     
  7. pinkfeet

    pinkfeet New Member HowtoForge Supporter

    Yes, I tried with other username in another web and its worked succesfully. As you said, I changed permissions before.

    Thanks you one more time.

    Ticket Solved.
     

Share This Page